Resolves remaining issues with xenohydro PR.

This commit is contained in:
Zuhayr
2015-02-24 17:55:39 +10:30
parent ee0d63a43d
commit 391ddd970e
4 changed files with 33 additions and 11 deletions
@@ -114,11 +114,11 @@
spread_chance = seed.get_trait(TRAIT_POTENCY)
spread_distance = ((growth_type>0) ? round(spread_chance*0.6) : round(spread_chance*0.3))
set_dir(calc_dir())
update_icon()
spawn(1)
spawn(1) // Plants will sometimes be spawned in the turf adjacent to the one they need to end up in, for the sake of correct dir/etc being set.
set_dir(calc_dir())
update_icon()
plant_controller.add_plant(src)
// Some plants eat through plating.
if(!isnull(seed.chems["pacid"]))
+1 -1
View File
@@ -530,7 +530,7 @@
A.hydrotray_type = src.type
del(src)
else if(O.force && seed)
user.visible_message("<span class='danger'>\The [user] attacks the [seed.display_name] with \the [O]!</span>")
user.visible_message("<span class='danger'>\The [seed.display_name] has been attacked by [user] with \the [O]!</span>")
if(!dead)
health -= O.force
check_health()
@@ -36,8 +36,7 @@
if(age >= seed.get_trait(TRAIT_MATURATION))
overlay_stage = seed.growth_stages
else
overlay_stage = max(1,round(seed.get_trait(TRAIT_MATURATION) / seed.growth_stages))
overlay_stage = max(1,round(age/round(seed.get_trait(TRAIT_MATURATION)/seed.growth_stages)))
var/ikey = "[seed.get_trait(TRAIT_PLANT_ICON)]-[overlay_stage]"
var/image/plant_overlay = plant_controller.plant_icon_cache["[ikey]-[seed.get_trait(TRAIT_PLANT_COLOUR)]"]
if(!plant_overlay)
+28 -5
View File
@@ -3,8 +3,8 @@
#define GAS 3
#define CHEM_DISPENSER_ENERGY_COST 0.1 //How many energy points do we use per unit of chemical?
#define BOTTLE_SPRITES list("bottle-1", "bottle-2", "bottle-3", "bottle-4") //list of available bottle sprites
#define REAGENTS_PER_SHEET 20
/obj/machinery/chem_dispenser
name = "chem dispenser"
@@ -827,6 +827,14 @@
var/obj/item/weapon/reagent_containers/beaker = null
var/limit = 10
var/list/holdingitems = list()
var/list/sheet_reagents = list(
/obj/item/stack/sheet/mineral/iron = "iron",
/obj/item/stack/sheet/mineral/uranium = "uranium",
/obj/item/stack/sheet/mineral/phoron = "phoron",
/obj/item/stack/sheet/mineral/gold = "gold",
/obj/item/stack/sheet/mineral/silver = "silver",
/obj/item/stack/sheet/mineral/mhydrogen = "hydrogen"
)
/obj/machinery/reagentgrinder/New()
..()
@@ -857,12 +865,10 @@
usr << "The machine cannot hold anymore items."
return 1
//Fill machine with the plantbag!
if(!istype(O))
return
if(istype(O,/obj/item/weapon/storage/bag/plants))
var/failed = 1
for (var/obj/item/G in O.contents)
if(!O.reagents || !O.reagents.total_volume)
@@ -886,7 +892,7 @@
src.updateUsrDialog()
return 0
if(!O.reagents || !O.reagents.total_volume)
if(!sheet_reagents[O.type] && (!O.reagents || !O.reagents.total_volume))
user << "\The [O] is not suitable for blending."
return 1
@@ -1008,8 +1014,25 @@
// Process.
for (var/obj/item/O in holdingitems)
O.reagents.trans_to(beaker, min(O.reagents.total_volume, (beaker.reagents.maximum_volume - beaker.reagents.total_volume)))
if(!O || !istype(O))
holdingitems -= null
continue
var/remaining_volume = beaker.reagents.maximum_volume - beaker.reagents.total_volume
if(sheet_reagents[O.type])
var/obj/item/stack/stack = O
if(istype(stack))
var/amount_to_take = max(0,min(stack.amount,round(remaining_volume/REAGENTS_PER_SHEET)))
if(amount_to_take)
stack.use(amount_to_take)
beaker.reagents.add_reagent(sheet_reagents[stack.type], (amount_to_take*REAGENTS_PER_SHEET))
continue
O.reagents.trans_to(beaker, min(O.reagents.total_volume, remaining_volume))
if(O.reagents.total_volume == 0)
remove_object(O)
if (beaker.reagents.total_volume >= beaker.reagents.maximum_volume)
break
#undef REAGENTS_PER_SHEET