Closed deontologician closed 10 years ago
Another thought: since the inventory might not be done when this is done. Assume there's an inventory object that has a method called store
(think "store this for me"), and that the method accepts whatever object you want to put into it.
@deontologician Could the store operate as a huge list of items available? If so, then someone could just copy the stats and everything with the 'buy' command?
Yeah, the store should have every item possible registered with it. There should be one store in existence Each time you purchase an item, you'll need to instantiate an item of that type. Probably, you'll want to store the class itself in a large dictionary:
from components import Raygun, Armor, ...
all_items = {'raygun': Raygun,
'armor': Armor,
...
}
This was partially implemented by @Dr4k3-M0nt4g , @MangroveCuckoo and I in c4b1a4c
The next steps are:
SpaceshipCommand
class. Currently it has an inventory and a bus.SpaceshipCommand
called do_purchase
that buys the specified item from the shop and puts it into the player's inventory
We need a way to be able to purchase components.
I propose we have a "store" that you can get whatever you want from. Initially, everything will be free to aid in convenience.
Once we get more to the game portion we can do things like adding money into the equation.
Example:
This also relates to the player's inventory #30 . We need one of those too.
Basic sketch of how this might work:
We need some kind of
Registry
that holds every kind of thing that can be purchased, along with a simple name likecable-tube
in the example above that uniquely identifies that kind of thing.Then we need the
purchase
command in the commandline to be able to create a new thing based on what the user requested, and add it to their inventory. Again, this is dependent on #30 being done.