mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Fixed SpiderOS chemical injections to work a lot better. Thanks to Muskets and Darem.
Added a new reagent proc (trans_id_to) to transfer a specific reagent from a list to the target. Finished SpiderOS. If anyone plans to revise PDA code, or maybe do something similar, I highly recommend looking at the SpiderOS verb first. Ninjas may now drain energy from exposed wires, ala a powersink. It takes longer than APCs to begin charging and drains slower. Misc bug fixes and improvements. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1460 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -79,6 +79,31 @@ datum
|
||||
src.handle_reactions()
|
||||
return amount
|
||||
|
||||
trans_id_to(var/obj/target, var/reagent, var/amount=1, var/preserve_data=1)//Not sure why this proc didn't exist before. It does now! /N
|
||||
if (!target)
|
||||
return
|
||||
if (!target.reagents || src.total_volume<=0 || !src.get_reagent_amount(reagent))
|
||||
return
|
||||
|
||||
var/datum/reagents/R = target.reagents
|
||||
if(src.get_reagent_amount(reagent)<amount)
|
||||
amount = src.get_reagent_amount(reagent)
|
||||
amount = min(amount, R.maximum_volume-R.total_volume)
|
||||
var/trans_data = null
|
||||
for (var/datum/reagent/current_reagent in src.reagent_list)
|
||||
if(current_reagent.id == reagent)
|
||||
if(preserve_data)
|
||||
trans_data = current_reagent.data
|
||||
R.add_reagent(current_reagent.id, amount, trans_data)
|
||||
src.remove_reagent(current_reagent.id, amount)
|
||||
break
|
||||
|
||||
src.update_total()
|
||||
R.update_total()
|
||||
R.handle_reactions()
|
||||
src.handle_reactions()
|
||||
return amount
|
||||
|
||||
/*
|
||||
if (!target) return
|
||||
var/total_transfered = 0
|
||||
|
||||
@@ -34,6 +34,11 @@ About the Holder:
|
||||
to transfer to and the amount you want to transfer. Its return value is the
|
||||
actual amount transfered (if one of the objects is full/empty)
|
||||
|
||||
trans_id_to(var/obj/target, var/reagent, var/amount)
|
||||
Same as above but only for a specific reagent in the reagent list.
|
||||
If the specified amount is greater than what is available, it will use
|
||||
the amount of the reagent that is available. If no reagent exists, returns null.
|
||||
|
||||
metabolize(var/mob/M)
|
||||
This proc is called by the mobs life proc. It simply calls on_mob_life for
|
||||
all contained reagents. You shouldnt have to use this one directly.
|
||||
|
||||
Reference in New Issue
Block a user