In a attempt to make stations more dynamic, I've made a station that will produce items from other items, turning uranium ore into uranium fuel rods for example.
The technical details:
The 'recipes' are held in static data on the station in nested lists
Code: Select all
'(
'(;; recipe 1
'(
;; production items number produced
'(&itUraniumRods; 4)
)
'(
;; consumption items number consumed
'(&itUraniumOre; 5)
)
)
Code: Select all
'(;; recipe 2
'(
'(&itRedNebulaBeer; 1)
'(&itEuropanIceVodka; 1)
)
'(
'(&itGradeAGrains; 3)
'(&itWaterIce; 10)
)
)
Finally, an event inspects the recipes and it's inventory and completes the appropriate actions:
Code: Select all
;; don't run if the player is docked
(if (not (objIsDockedAt gPlayerShip gSource))
(block ((recipeList (objGetStaticData gSource "Produce")))
;; go through all the recipes in static data for this station
(enum recipeList thisRecipe
(block (hasAllConsItms (prodList (item thisRecipe 0)) (consList (item thisRecipe 1)))
;; check if we have all the necessary items for this recipe
(setq hasAllConsItms True)
(enum consList thisItem (block Nil
(if (not (objHasItem gSource (itmCreate (item thisItem 0) (item thisItem 1))))
(setq hasAllConsItms Nil)
)
))
;; if we have all the items, produce the recipe items and remove the consumption items
(if hasAllConsItms (block Nil
(enum prodList thisItem (objAddItem gSource (itmCreate (item thisItem 0) (item thisItem 1))))
(enum consList thisItem (objRemoveItem gSource (itmCreate (item thisItem 0) (item thisItem 1))))
))
)
)
)
)
This provides opportunities for the player to attack the supply freighters, disrupting the flow of raw materials and increasing the price on the station as the stock dwindles. Alternatively, the player can deliver raw materials, wait for the production to increase and buy the finished products in bulk at a discount.
What other kinds of stations would be interesting to see?
What kinds of recipes would you like to see?
What new items would be required?