rendering items, pick up, iventory re-make in progress to aloow item drop/wear/whatever
This commit is contained in:
@ -50,6 +50,8 @@ func (c Carried) Pickup(who, what ecs.Entity) {
|
||||
//remove coords instead (does not exist on map anymore)
|
||||
Controller.RemoveComponent(what, ecs.CoordsComponent)
|
||||
bp.items = append(bp.items, what)
|
||||
//fuck that, we need to update constantly
|
||||
Controller.UpdateComponent(who, ecs.BackpackComponent, bp)
|
||||
}
|
||||
|
||||
func (c Carried) Drop(who, what ecs.Entity) {
|
||||
@ -87,11 +89,12 @@ func (c *Carried) GetBulk(what ecs.Entity) int {
|
||||
return c.Bulk
|
||||
}
|
||||
|
||||
func FindCarriedOnTile(coords types.Coords) []ecs.Entity {
|
||||
func FindCarriedUnder(who ecs.Entity) []ecs.Entity {
|
||||
coords := Controller.GetComponent(who, ecs.CoordsComponent).(types.Coords)
|
||||
carrieds := Controller.GetEntitiesWithComponent(ecs.CarriedComponent)
|
||||
result := make([]ecs.Entity, 0)
|
||||
for _, ent := range carrieds {
|
||||
car := Controller.GetComponent(ent, ecs.CarriedComponent)
|
||||
car := Controller.GetComponent(ent, ecs.CoordsComponent)
|
||||
if car == coords {
|
||||
result = append(result, ent)
|
||||
}
|
||||
|
Reference in New Issue
Block a user