Skip to content

Feature Parity #3

@noodlebox

Description

@noodlebox

Aside from the intentionally modified behaviors, machines controlled by this mod should behave just as those in the base game. This is meant to serve as both a TODO list for this mod as well as documentation for future projects.

The most important part of this is maintaining consistent settings as game state changes. State data is represented in one of two ways: working entities will have a corresponding entry in storage.selectors (by unit_number or -unit_number) and ghosts or blueprint entities have tag data. These interactions should be handled properly:

  • Entity configuration by player via GUI
  • Ghost entity configuration by player via GUI
  • (Partial) Changes to pickup_position or drop_position by other mods. Currently known mods requiring handling:
  • Entity moved. Handled trivially via events: on_player_rotated_entity, on_player_flipped_entity, script_raised_teleported.
  • Revival after death. Store tags on newly created ghost in on_post_entity_died.
  • Blueprint creation and copy/paste (ctrl+C, ctrl+V). Store tags on blueprint entities in on_player_setup_blueprint.
  • Fast replacement and upgrade planner. Entity created after old one mined and id of replaced entity not directly available, so this needs an additional mapping of location to configuration data.
    • Upgrade is imminent after either on_marked_for_upgrade or on_pre_build, but stored data could be stale by the time it's needed.
    • Should probably handle entity mined events: on_player_mined_entity, on_robot_mined_entity, on_space_platform_mined_entity. Use GPS tag as key, storing tick number and configuration, to be used in case of subsequent entity creation on same tick. This list should be purged occasionally, though less often than on_tick if event tick is recorded here.
  • Overwrite settings on forced paste. There are some cases where on_pre_build leads to no entities created or destroyed, but may create wires or should apply settings to existing entities.
  • Settings copy/paste (shift+rclick, shift+click). Simply copy via tags.
  • Entity clone. Copy settings via tags.
  • Undo/redo support. This is trickier, as there is some "historical revisionism" performed by the base game, where multiple undo levels may be modified (apparently redundantly?) by certain actions, so we need to make sure any settings stored on the undo stack are not clobbered by other actions.
  • Set up from tags if present: on_built_entity, on_robot_built_entity, on_space_platform_built_entity, script_raised_revive.
  • Permanent entity destruction.
    • Currently making heavy use of on_object_destroyed, which seems reasonable so far, but should explore how this affects or is affected by other mods using it extensively as well. Performance impact of notify() should be minimal for untracked entities.
    • Note that this is called after entity creation on fast replacement, so make sure not to clobber new settings.

Other inserter quirks to preserve (or not):

  • Inserters targeting rail entities should set their status to "Waiting for train".
  • Inserters forced idle because of a "None" setting should set their status to "No filter".
  • Pickup/drop onto ground (or inserter "hand-off") is disabled, as intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions