darozak / Advolition

1 stars 0 forks source link

Allow robots to drop and pick up items #46

Closed darozak closed 5 months ago

darozak commented 6 months ago

Create a system by which robots can drop and pick up items. Dropped items will persist in the arena and can be scanned.

darozak commented 5 months ago

One option is to allow robots access to any items they are standing over.

The robot can move items to the top or bottom of its inventory list and set the equip and cary thresholds within limits.

When a robot leaves a tile it will only cary with it the number of items under this threshold.

darozak commented 5 months ago

Another thought is to have separate equipped, carried, and dropped lists.

When a robot picks up an item it will be moved to the top of the carried list and any excess items will be moved to the top of the dropped list.

If a robot equips an item it will be moved from the carried list to the top of the equipped list and any excess items will be placed at the top of the equipped list.

If a robot unequips an item it will be moved to the top of the carry list and nothing will need to be removed from the carry list because there is no weight being added to the inventory.

If a robot drops an item, it will be removed from the carry list first and the equipped list second to be placed in the dropped tile.

darozak commented 5 months ago

Perhaps the simplest and most flexable strategy is to permit a robot to pick up an item if it won't exceed the robot's carrying capacity.

The newly acquired item will be added to the bottom of the robot's inventory.

To equip it, the robot must prioritize (or favor) the item. This will move the item to the top of the robot's inventory and equip it if a slot is available.

A robot can also choose to drop an item that it's holding.

darozak commented 5 months ago

Robot can drop an item from its inventory. The dropped item is tacked on the arena map and appears in scans (https://github.com/darozak/Advolition/commit/dc56c61b6569c337247c9c521d63f5bf939ed605).

Next, I need to allow the robot to pick up the item.

darozak commented 5 months ago

Finished. Can pick up items as well (https://github.com/darozak/Advolition/commit/afc6e8d5da6727449c4ca1a979679d9674bd6568).