Item Console Commands

    Asvarduil

    Builder of Very Small Ships
    Joined
    Apr 17, 2015
    Messages
    272
    Reaction score
    133
    • Community Content - Bronze 1
    • Purchased!
    So, I'm working on a mod for StarMade, which is in my signature. My research of the Command Line API has revealed some opportunities for commands that could make the game more easily moddable using existing techniques such as "Shadow"'s log-scraping/screen command setup.

    One thing I want greater control of, for a variety of reasons, is what spawns in containers. Currently, when certain entities spawn, in certain circumstances, if they have a Cargo module and storage space, each space will fill with random items. While this does generate loot, from a game balance/server administration perspective, this is problematic, as I can't control what's spawned.

    A hypothetical command set that would grant us that ability looks like this:

    Proposed Container/Item Management Commands

    /entity_containers {entity_id}

    Entity Containers: Get a comma-separated list of all containers on a given entity (ship, station, planet segment, floating rock). If the entity does not exist, log a message on the server. If the entity can't support containers, log a message on the server. If no containers exist on the entity, log a message on the server.

    /container_exists {container_id}
    Container Exists: Returns true if a container with name Container_ID exists, otherwise false.

    /container_open_slot_count {container_id}
    Container Slot Count: For the container with name Container_ID, return the number of open slots. If the container does not exist, log a message on the server.

    /container_put {container_id} {item_id} {quantity}
    Container Put: For the container with name Container_ID, put Quantity of Item_ID in the first available slot. If no slot is available, log a message on the server. If the container does not exist, log a message on the server. Container Put ignores volume restrictions. Internally, container_put calls the container_open_slot_count to determine whether the container has available slots for items.

    /container_remove {container_id} {item_id} {quantity}
    Container Remove: For the container with name Container_ID, attempt to destroy Quantity of Item_ID. If the item does not exist in the container, log a mesage on the server. If the container does not exist, log a message on the server.

    /container_clear {container_id}
    Container Clear: Removes all items from all slots in the container with name Container_ID. If the container does not exist, log a message on the server.

    Use Cases

    Server Events

    As an admin, I may want to host an event. Example: "Dueling mecha tournament on {PLANET}! Build a mecha of no more than 10 mass and beat all other competitors!"

    I can use an admin command to spawn prizes into a chest manually, so that the winner wins something.

    The reason for the /container_remove and /container_clear commands, is for if the admin - a human - screws up.

    Loot & Loot Tables
    If I spawn in a ship or station using the /load command, I may want to populate it with loot, such that it can be boarded, or destroyed and the loot collected by my players. As part of my custom server code, I can create a loot table like so:

    Ship - Mjolnir Raider
    Blue Hull x20-50, 80%
    Black Hull x20-50, 60%
    Black Light x5-15, 50%
    Power Reactor x5-10, 50%
    Thruster x5-10, 25%
    Cannon Barrel x4-10, 10%
    Missile Tube x4-10, 10%
    Cannon Computer x1-2, 5%
    Missile Computer x1-2, 5%

    Then, I can repeatedly call /container_open_slot_count, and read the log to determine how many slots are available to me; as long as that number is > 0, I can roll for a position on my loot table, then roll for whether the item is selected, then roll for quantity, and call /container_put to put the rolled item/quantity into the container.

    Going further, /container_clear lets me clear out any loot that the existing loot-generation system may make.

    Timed Trials
    Upon entering a hypothetical trigger block - a block that when the player intersects with it, logs a message to the server, something else I strongly suggest - I could spawn items into a storage system as above in the Loot Tables section. I could then start up a timed thread that periodically removes certain items until that thread is told to stop, using /container_remove. This would be particularly effective for a parkour challenge, where some loot is 'ensured' just for completing it, but additional loot is available for exceeding expectations.
     
    Last edited: