mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 13:37:58 +01:00
Moved a batch of unchecked and a few unused files into the unused folder.
Remember if your scrolling though the list and something is unchecked it should almost certainly be checked. Simple animals moved over to the actual mob code area and out of the defines. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2868 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -1,398 +0,0 @@
|
||||
// converyor belt
|
||||
|
||||
// moves items/mobs/movables in set direction every ptick
|
||||
|
||||
|
||||
/obj/machinery/conveyor
|
||||
icon = 'recycling.dmi'
|
||||
icon_state = "conveyor0"
|
||||
name = "conveyor belt"
|
||||
desc = "A conveyor belt."
|
||||
anchored = 1
|
||||
var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off
|
||||
var/operable = 1 // true if can operate (no broken segments in this belt run)
|
||||
var/basedir // this is the default (forward) direction, set by the map dir
|
||||
// note dir var can vary when the direction changes
|
||||
|
||||
var/list/affecting // the list of all items that will be moved this ptick
|
||||
var/id = "" // the control ID - must match controller ID
|
||||
// following two only used if a diverter is present
|
||||
var/divert = 0 // if non-zero, direction to divert items
|
||||
var/divdir = 0 // if diverting, will be conveyer dir needed to divert (otherwise dense)
|
||||
|
||||
|
||||
|
||||
// create a conveyor
|
||||
|
||||
/obj/machinery/conveyor/New()
|
||||
..()
|
||||
basedir = dir
|
||||
setdir()
|
||||
|
||||
// set the dir and target turf depending on the operating direction
|
||||
|
||||
/obj/machinery/conveyor/proc/setdir()
|
||||
if(operating == -1)
|
||||
dir = turn(basedir,180)
|
||||
else
|
||||
dir = basedir
|
||||
update()
|
||||
|
||||
|
||||
// update the icon depending on the operating condition
|
||||
|
||||
/obj/machinery/conveyor/proc/update()
|
||||
if(stat & BROKEN)
|
||||
icon_state = "conveyor-b"
|
||||
operating = 0
|
||||
return
|
||||
if(!operable)
|
||||
operating = 0
|
||||
icon_state = "conveyor[(operating != 0) && !(stat & NOPOWER)]"
|
||||
|
||||
|
||||
// machine process
|
||||
// move items to the target location
|
||||
/obj/machinery/conveyor/process()
|
||||
if(stat & (BROKEN | NOPOWER))
|
||||
return
|
||||
if(!operating)
|
||||
return
|
||||
use_power(100)
|
||||
|
||||
var/movedir = dir // base movement dir
|
||||
if(divert && dir==divdir) // update if diverter present
|
||||
movedir = divert
|
||||
|
||||
|
||||
affecting = loc.contents - src // moved items will be all in loc
|
||||
spawn(1) // slight delay to prevent infinite propagation due to map order
|
||||
var/items_moved = 0
|
||||
for(var/atom/movable/A in affecting)
|
||||
if(!A.anchored)
|
||||
if(isturf(A.loc)) // this is to prevent an ugly bug that forces a player to drop what they're holding if they recently pick it up from the conveyer belt
|
||||
if(ismob(A))
|
||||
var/mob/M = A
|
||||
if(M.buckled == src)
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, dir)
|
||||
M.buckled = null
|
||||
step(M,dir)
|
||||
if(C)
|
||||
M.buckled = C
|
||||
else
|
||||
new/obj/item/weapon/cable_coil/cut(M.loc)
|
||||
else
|
||||
step(M,movedir)
|
||||
else
|
||||
step(A,movedir)
|
||||
items_moved++
|
||||
if(items_moved >= 10)
|
||||
break
|
||||
|
||||
// attack with item, place item on conveyor
|
||||
|
||||
/obj/machinery/conveyor/attackby(var/obj/item/I, mob/user)
|
||||
if(istype(I, /obj/item/weapon/grab)) // special handling if grabbing a mob
|
||||
var/obj/item/weapon/grab/G = I
|
||||
G.affecting.Move(src.loc)
|
||||
del(G)
|
||||
return
|
||||
else if(istype(I, /obj/item/weapon/cable_coil)) // if cable, see if a mob is present
|
||||
var/mob/M = locate() in src.loc
|
||||
if(M)
|
||||
if (M == user)
|
||||
src.visible_message("\blue [M] ties \himself to the conveyor.")
|
||||
// note don't check for lying if self-tying
|
||||
else
|
||||
if(M.lying)
|
||||
user.visible_message("\blue [M] has been tied to the conveyor by [user].", "\blue You tie [M] to the converyor!")
|
||||
else
|
||||
user << "\blue [M] must be lying down to be tied to the converyor!"
|
||||
return
|
||||
M.buckled = src
|
||||
src.add_fingerprint(user)
|
||||
I:use(1)
|
||||
M.lying = 1
|
||||
return
|
||||
|
||||
// else if no mob in loc, then allow coil to be placed
|
||||
|
||||
else if(istype(I, /obj/item/weapon/wirecutters))
|
||||
var/mob/M = locate() in src.loc
|
||||
if(M && M.buckled == src)
|
||||
M.buckled = null
|
||||
src.add_fingerprint(user)
|
||||
if (M == user)
|
||||
src.visible_message("\blue [M] cuts \himself free from the conveyor.")
|
||||
else
|
||||
src.visible_message("\blue [M] had been cut free from the conveyor by [user].")
|
||||
return
|
||||
|
||||
if(isrobot(user))
|
||||
return
|
||||
|
||||
// otherwise drop and place on conveyor
|
||||
user.drop_item()
|
||||
if(I && I.loc) I.loc = src.loc
|
||||
return
|
||||
|
||||
// attack with hand, move pulled object onto conveyor
|
||||
|
||||
/obj/machinery/conveyor/attack_hand(mob/user as mob)
|
||||
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
|
||||
return
|
||||
if (user.pulling.anchored)
|
||||
return
|
||||
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
|
||||
return
|
||||
if (ismob(user.pulling))
|
||||
var/mob/M = user.pulling
|
||||
M.pulling = null
|
||||
step(user.pulling, get_dir(user.pulling.loc, src))
|
||||
user.pulling = null
|
||||
else
|
||||
step(user.pulling, get_dir(user.pulling.loc, src))
|
||||
user.pulling = null
|
||||
return
|
||||
|
||||
|
||||
// make the conveyor broken
|
||||
// also propagate inoperability to any connected conveyor with the same ID
|
||||
/obj/machinery/conveyor/proc/broken()
|
||||
stat |= BROKEN
|
||||
update()
|
||||
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, basedir)
|
||||
if(C)
|
||||
C.set_operable(basedir, id, 0)
|
||||
|
||||
C = locate() in get_step(src, turn(basedir,180))
|
||||
if(C)
|
||||
C.set_operable(turn(basedir,180), id, 0)
|
||||
|
||||
|
||||
//set the operable var if ID matches, propagating in the given direction
|
||||
|
||||
/obj/machinery/conveyor/proc/set_operable(stepdir, match_id, op)
|
||||
|
||||
if(id != match_id)
|
||||
return
|
||||
operable = op
|
||||
|
||||
update()
|
||||
var/obj/machinery/conveyor/C = locate() in get_step(src, stepdir)
|
||||
if(C)
|
||||
C.set_operable(stepdir, id, op)
|
||||
|
||||
/*
|
||||
/obj/machinery/conveyor/verb/destroy()
|
||||
set src in view()
|
||||
src.broken()
|
||||
*/
|
||||
|
||||
/obj/machinery/conveyor/power_change()
|
||||
..()
|
||||
update()
|
||||
|
||||
|
||||
// converyor diverter
|
||||
// extendable arm that can be switched so items on the conveyer are diverted sideways
|
||||
// situate in same turf as conveyor
|
||||
// only works if belts is running proper direction
|
||||
//
|
||||
//
|
||||
/obj/machinery/diverter
|
||||
icon = 'recycling.dmi'
|
||||
icon_state = "diverter0"
|
||||
name = "diverter"
|
||||
desc = "A diverter arm for a conveyor belt."
|
||||
anchored = 1
|
||||
layer = FLY_LAYER
|
||||
var/obj/machinery/conveyor/conv // the conveyor this diverter works on
|
||||
var/deployed = 0 // true if diverter arm is extended
|
||||
var/operating = 0 // true if arm is extending/contracting
|
||||
var/divert_to // the dir that diverted items will be moved
|
||||
var/divert_from // the dir items must be moving to divert
|
||||
|
||||
|
||||
// create a diverter
|
||||
// set up divert_to and divert_from directions depending on dir state
|
||||
/obj/machinery/diverter/New()
|
||||
|
||||
..()
|
||||
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
divert_to = WEST // stuff will be moved to the west
|
||||
divert_from = NORTH // if entering from the north
|
||||
if(SOUTH)
|
||||
divert_to = EAST
|
||||
divert_from = NORTH
|
||||
if(EAST)
|
||||
divert_to = EAST
|
||||
divert_from = SOUTH
|
||||
if(WEST)
|
||||
divert_to = WEST
|
||||
divert_from = SOUTH
|
||||
if(NORTHEAST)
|
||||
divert_to = NORTH
|
||||
divert_from = EAST
|
||||
if(NORTHWEST)
|
||||
divert_to = NORTH
|
||||
divert_from = WEST
|
||||
if(SOUTHEAST)
|
||||
divert_to = SOUTH
|
||||
divert_from = EAST
|
||||
if(SOUTHWEST)
|
||||
divert_to = SOUTH
|
||||
divert_from = WEST
|
||||
spawn(2)
|
||||
// wait for map load then find the conveyor in this turf
|
||||
conv = locate() in src.loc
|
||||
if(conv) // divert_from dir must match possible conveyor movement
|
||||
if(conv.basedir != divert_from && conv.basedir != turn(divert_from,180) )
|
||||
del(src) // if no dir match, then delete self
|
||||
set_divert()
|
||||
update()
|
||||
|
||||
// update the icon state depending on whether the diverter is extended
|
||||
/obj/machinery/diverter/proc/update()
|
||||
icon_state = "diverter[deployed]"
|
||||
|
||||
// call to set the diversion vars of underlying conveyor
|
||||
/obj/machinery/diverter/proc/set_divert()
|
||||
if(conv)
|
||||
if(deployed)
|
||||
conv.divert = divert_to
|
||||
conv.divdir = divert_from
|
||||
else
|
||||
conv.divert= 0
|
||||
|
||||
|
||||
// *** TESTING click to toggle
|
||||
/obj/machinery/diverter/Click()
|
||||
toggle()
|
||||
|
||||
|
||||
// toggle between arm deployed and not deployed, showing animation
|
||||
//
|
||||
/obj/machinery/diverter/proc/toggle()
|
||||
if( stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
|
||||
if(operating)
|
||||
return
|
||||
|
||||
use_power(50)
|
||||
operating = 1
|
||||
if(deployed)
|
||||
flick("diverter10",src)
|
||||
icon_state = "diverter0"
|
||||
sleep(10)
|
||||
deployed = 0
|
||||
else
|
||||
flick("diverter01",src)
|
||||
icon_state = "diverter1"
|
||||
sleep(10)
|
||||
deployed = 1
|
||||
operating = 0
|
||||
update()
|
||||
set_divert()
|
||||
|
||||
// don't allow movement into the 'backwards' direction if deployed
|
||||
/obj/machinery/diverter/CanPass(atom/movable/O, var/turf/target)
|
||||
var/direct = get_dir(O, target)
|
||||
if(direct == divert_to) // prevent movement through body of diverter
|
||||
return 0
|
||||
if(!deployed)
|
||||
return 1
|
||||
return(direct != turn(divert_from,180))
|
||||
|
||||
// don't allow movement through the arm if deployed
|
||||
/obj/machinery/diverter/CheckExit(atom/movable/O, var/turf/target)
|
||||
var/direct = get_dir(O, target)
|
||||
if(direct == turn(divert_to,180)) // prevent movement through body of diverter
|
||||
return 0
|
||||
if(!deployed)
|
||||
return 1
|
||||
return(direct != divert_from)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// the conveyor control switch
|
||||
//
|
||||
//
|
||||
|
||||
/obj/machinery/conveyor_switch
|
||||
|
||||
name = "conveyor switch"
|
||||
desc = "A conveyor control switch."
|
||||
icon = 'recycling.dmi'
|
||||
icon_state = "switch-off"
|
||||
var/position = 0 // 0 off, -1 reverse, 1 forward
|
||||
var/last_pos = -1 // last direction setting
|
||||
var/operated = 1 // true if just operated
|
||||
|
||||
var/id = "" // must match conveyor IDs to control them
|
||||
|
||||
var/list/conveyors // the list of converyors that are controlled by this switch
|
||||
anchored = 1
|
||||
|
||||
|
||||
|
||||
/obj/machinery/conveyor_switch/New()
|
||||
..()
|
||||
update()
|
||||
|
||||
spawn(5) // allow map load
|
||||
conveyors = list()
|
||||
for(var/obj/machinery/conveyor/C in world)
|
||||
if(C.id == id)
|
||||
conveyors += C
|
||||
|
||||
// update the icon depending on the position
|
||||
|
||||
/obj/machinery/conveyor_switch/proc/update()
|
||||
if(position<0)
|
||||
icon_state = "switch-rev"
|
||||
else if(position>0)
|
||||
icon_state = "switch-fwd"
|
||||
else
|
||||
icon_state = "switch-off"
|
||||
|
||||
|
||||
// timed process
|
||||
// if the switch changed, update the linked conveyors
|
||||
|
||||
/obj/machinery/conveyor_switch/process()
|
||||
if(!operated)
|
||||
return
|
||||
operated = 0
|
||||
|
||||
for(var/obj/machinery/conveyor/C in conveyors)
|
||||
C.operating = position
|
||||
C.setdir()
|
||||
|
||||
// attack with hand, switch position
|
||||
/obj/machinery/conveyor_switch/attack_hand(mob/user)
|
||||
if(position == 0)
|
||||
if(last_pos < 0)
|
||||
position = 1
|
||||
last_pos = 0
|
||||
else
|
||||
position = -1
|
||||
last_pos = 0
|
||||
else
|
||||
last_pos = position
|
||||
position = 0
|
||||
|
||||
operated = 1
|
||||
update()
|
||||
|
||||
// find any switches with same id as this one, and set their positions to match us
|
||||
for(var/obj/machinery/conveyor_switch/S in world)
|
||||
if(S.id == src.id)
|
||||
S.position = position
|
||||
S.update()
|
||||
@@ -1,289 +0,0 @@
|
||||
// The scrap item
|
||||
// a single object type represents all combinations of size and composition of scrap
|
||||
//
|
||||
|
||||
|
||||
/obj/item/scrap
|
||||
name = "scrap"
|
||||
icon = 'scrap.dmi'
|
||||
icon_state = "1metal0"
|
||||
item_state = "scrap-metal"
|
||||
desc = "A piece of scrap"
|
||||
var/classtext = ""
|
||||
throwforce = 14.0
|
||||
m_amt = 0
|
||||
g_amt = 0
|
||||
w_amt = 0
|
||||
var/size = 1 // 1=piece, 2= few pieces, 3=small pile, 4=large pile
|
||||
var/blood = 0 // 0=none, 1=blood-stained, 2=bloody
|
||||
|
||||
throwforce = 8.0
|
||||
throw_speed = 1
|
||||
throw_range = 4
|
||||
w_class = 1
|
||||
flags = FPRINT | TABLEPASS | CONDUCT
|
||||
|
||||
#define MAX_SCRAP 15000 // maximum content amount of a scrap pile
|
||||
|
||||
|
||||
/obj/item/scrap/New()
|
||||
src.verbs -= /atom/movable/verb/pull
|
||||
..()
|
||||
update()
|
||||
|
||||
// return a copy
|
||||
/obj/item/scrap/proc/copy()
|
||||
var/obj/item/scrap/ret = new()
|
||||
ret.set_components(m_amt, g_amt, w_amt)
|
||||
return ret
|
||||
|
||||
|
||||
// set the metal, glass and waste content
|
||||
/obj/item/scrap/proc/set_components(var/m, var/g, var/w)
|
||||
m_amt = m
|
||||
g_amt = g
|
||||
w_amt = w
|
||||
update()
|
||||
|
||||
// returns the total amount of scrap in this pile
|
||||
/obj/item/scrap/proc/total()
|
||||
return m_amt + g_amt + w_amt
|
||||
|
||||
|
||||
// sets the size, appearance, and description of the scrap depending on component amounts
|
||||
/obj/item/scrap/proc/update()
|
||||
var/total = total()
|
||||
|
||||
|
||||
// determine size of pile
|
||||
if(total<=400)
|
||||
size = 1
|
||||
else if(total<=1600)
|
||||
size = 2
|
||||
else
|
||||
size = 3
|
||||
|
||||
w_class = size
|
||||
|
||||
var/sizetext = ""
|
||||
|
||||
switch(size)
|
||||
if(1)
|
||||
sizetext = "A piece of"
|
||||
if(2)
|
||||
sizetext = "A few pieces of"
|
||||
if(3)
|
||||
sizetext = "A pile of"
|
||||
|
||||
// determine bloodiness
|
||||
var/bloodtext = ""
|
||||
switch(blood)
|
||||
if(0)
|
||||
bloodtext = ""
|
||||
if(1)
|
||||
bloodtext = "blood-stained "
|
||||
if(2)
|
||||
bloodtext = "bloody "
|
||||
|
||||
|
||||
// find mixture and composition
|
||||
var/class = 0 // 0 = mixed, 1=mostly. 2=pure
|
||||
var/major = "waste" // the major component type
|
||||
|
||||
var/max = 0
|
||||
|
||||
if(m_amt > max)
|
||||
max = m_amt
|
||||
else if(g_amt > max)
|
||||
max = g_amt
|
||||
else if(w_amt > max)
|
||||
max = w_amt
|
||||
|
||||
if(max == total)
|
||||
class = 2 // pure
|
||||
else if(max/total > 0.6)
|
||||
class = 1 // mostly
|
||||
else
|
||||
class = 0 // mixed
|
||||
|
||||
if(class>0)
|
||||
var/remain = total - max
|
||||
if(m_amt > remain)
|
||||
major = "metal"
|
||||
else if(g_amt > remain)
|
||||
major = "glass"
|
||||
else
|
||||
major = "waste"
|
||||
|
||||
|
||||
if(class == 1)
|
||||
desc = "[sizetext] mostly [major] [bloodtext]scrap."
|
||||
classtext = "mostly [major] [bloodtext]"
|
||||
else
|
||||
desc = "[sizetext] [bloodtext][major] scrap."
|
||||
classtext = "[bloodtext][major] "
|
||||
icon_state = "[size][major][blood]"
|
||||
else
|
||||
desc = "[sizetext] [bloodtext]mixed scrap."
|
||||
classtext = "[bloodtext]mixed"
|
||||
icon_state = "[size]mixed[blood]"
|
||||
|
||||
if(size==0)
|
||||
pixel_x = rand(-5,5)
|
||||
pixel_y = rand(-5,5)
|
||||
else
|
||||
pixel_x = 0
|
||||
pixel_y = 0
|
||||
|
||||
// clear or set conduction flag depending on whether scrap is mostly metal
|
||||
if(major=="metal")
|
||||
flags |= CONDUCT
|
||||
else
|
||||
flags &= ~CONDUCT
|
||||
|
||||
item_state = "scrap-[major]"
|
||||
|
||||
// add a scrap item to this one
|
||||
// if the resulting pile is too big, transfer only what will fit
|
||||
// otherwise add them and deleted the added pile
|
||||
|
||||
/obj/item/scrap/proc/add_scrap(var/obj/item/scrap/other, var/limit = MAX_SCRAP)
|
||||
var/total = total()
|
||||
var/other_total = other.total()
|
||||
|
||||
if( (total + other_total) <= limit )
|
||||
m_amt += other.m_amt
|
||||
g_amt += other.g_amt
|
||||
w_amt += other.w_amt
|
||||
|
||||
blood = (total*blood + other_total*other.blood) / (total + other_total)
|
||||
del(other)
|
||||
|
||||
else
|
||||
var/space = limit - total
|
||||
|
||||
var/m = round(other.m_amt/other_total*space, 1)
|
||||
var/g = round(other.g_amt/other_total*space, 1)
|
||||
var/w = round(other.w_amt/other_total*space, 1)
|
||||
|
||||
m_amt += m
|
||||
g_amt += g
|
||||
w_amt += w
|
||||
|
||||
other.m_amt -= m
|
||||
other.g_amt -= g
|
||||
other.w_amt -= w
|
||||
|
||||
var/other_trans = m + g + w
|
||||
other.update()
|
||||
blood = (total*blood + other_trans*other.blood) / (total + other_trans)
|
||||
|
||||
|
||||
blood = round(blood,1)
|
||||
src.update()
|
||||
|
||||
// limit this pile to maximum size
|
||||
// return any remainder as a new scrap item (or null if none)
|
||||
// note return item is not necessarily smaller than max size
|
||||
|
||||
/obj/item/scrap/proc/remainder(var/limit = MAX_SCRAP)
|
||||
var/total = total()
|
||||
if(total > limit)
|
||||
var/m = round( m_amt/total * limit, 1)
|
||||
var/g = round( g_amt/total * limit, 1)
|
||||
var/w = round( w_amt/total * limit, 1)
|
||||
|
||||
var/obj/item/scrap/S = new()
|
||||
S.set_components(m_amt - m,g_amt - g,w_amt - w)
|
||||
src.set_components(m,g,w)
|
||||
|
||||
return S
|
||||
return null
|
||||
|
||||
// if other pile of scrap tries to enter the same turf, then add that pile to this one
|
||||
|
||||
/obj/item/scrap/CanPass(var/obj/item/scrap/O)
|
||||
|
||||
if(istype(O))
|
||||
|
||||
src.add_scrap(O)
|
||||
if(O)
|
||||
return 0 // O still exists if not all could be transfered, so block it
|
||||
return 1
|
||||
|
||||
/obj/item/scrap/proc/to_text()
|
||||
return "[m_amt],[g_amt],[w_amt] ([total()])"
|
||||
|
||||
|
||||
// attack with hand removes a single piece from a pile
|
||||
/obj/item/scrap/attack_hand(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(src.is_single_piece())
|
||||
return ..(user)
|
||||
var/obj/item/scrap/S = src.get_single_piece()
|
||||
S.attack_hand(user)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/scrap/attackby(obj/item/I, mob/user)
|
||||
..()
|
||||
if(istype(I, /obj/item/scrap))
|
||||
var/obj/item/scrap/S = I
|
||||
if( (S.total()+src.total() ) > MAX_SCRAP )
|
||||
user << "The pile is full."
|
||||
return
|
||||
if(ismob(src.loc)) // can't combine scrap in hand
|
||||
return
|
||||
|
||||
src.add_scrap(S)
|
||||
|
||||
// when dropped, try to make a pile if scrap is already there
|
||||
/obj/item/scrap/dropped()
|
||||
|
||||
spawn(2) // delay to allow drop postprocessing (since src may be destroyed)
|
||||
for(var/obj/item/scrap/S in oview(0,src)) // excludes src itself
|
||||
S.add_scrap(src)
|
||||
|
||||
// return true if this is a single piece of scrap
|
||||
// must be total<=400 and of single composition
|
||||
/obj/item/scrap/proc/is_single_piece()
|
||||
if(total() > 400)
|
||||
return 0
|
||||
|
||||
var/empty = (m_amt == 0) + (g_amt == 0) + (w_amt == 0)
|
||||
|
||||
return (empty==2) // must be 2 components with zero amount
|
||||
|
||||
|
||||
// get a single piece of scrap from a pile
|
||||
/obj/item/scrap/proc/get_single_piece()
|
||||
|
||||
var/obj/item/scrap/S = new()
|
||||
|
||||
var/cmp = pick(m_amt;1 , g_amt;2, w_amt;3)
|
||||
|
||||
var/amount = 400
|
||||
switch(cmp)
|
||||
if(1)
|
||||
if(m_amt < amount)
|
||||
amount = m_amt
|
||||
|
||||
S.set_components(amount, 0, 0)
|
||||
src.set_components(m_amt - amount, g_amt, w_amt)
|
||||
|
||||
if(2)
|
||||
if(g_amt < amount)
|
||||
amount = g_amt
|
||||
S.set_components(0, amount, 0)
|
||||
src.set_components(m_amt, g_amt - amount, w_amt)
|
||||
|
||||
if(3)
|
||||
if(w_amt < amount)
|
||||
amount = w_amt
|
||||
S.set_components(0, 0, amount)
|
||||
src.set_components(m_amt, g_amt, w_amt - amount)
|
||||
|
||||
|
||||
return S
|
||||
|
||||
|
||||
Reference in New Issue
Block a user