System ‐ Wind - Orion351/hidden-worlds GitHub Wiki

Overview

Wind disrupts the surface across which it blows in several ways:

  • Items on belts or on the ground can be blown around.
  • (Potentially) Items in inserter hands, in assemblers, or in chests can be Swept (blown away).
  • Power Poles can be knocked down
  • Bots can be knocked out of the air

Wind is also useful

  • Sand tiles under Gusts will Sweep Sand items into the air, which can clutter a base if unchecked but can also act as a supply for sand
  • Wind Turbines will blow when touched by a Gust/

Notes:

  • Wind blows in one direction ONLY for the whole surface of the planet, picked randomly at surface generation

Mitigation

  • Wind Shelters create square, adjacent Safe Zones (SZ). Gusts dissipate if they touch an SZ.
  • Swept items that hit Wind Shelters drop where struck.
    • Some entities are also tall enough to act as a Blocker in this way

Implementation

Wind happens as follows:

  • Periodically (using Fulgora's Lightning system), Windstorms will occur. This causes Gusts to spawn.
  • Gusts are styled as Whirlwinds, spawn at 'lightning strikes,' and roam in one direction.
    • Need to bake a set of Gust paths into tables. Each path element in the table is a thruple: ticks at this position, x-offset, y-offset.
    • Need an animation for the whirlwind spinning
    • Need an animation for the whirlwind dissipating
  • Any item in a certain radius from a Gust's center will be Swept (implementation temporarily moved to a temp inventory, a RenderObject mimic is thrown up in a parabolic path, and the item is 'dropped' wherever it lands -- where it may be Swept again).
    • Items on Belts, Underground Belts and Splitters are all Sweepable
    • Need to bake a set of Sweep paths into tables. Each path element in the table is a float value representing scale (quadratic).
    • The x, y, and rotation values are randomly determined when Swept, which evolve linearly
    • When Swept, the system calculates where it will hit a Blocker, if at all; this will cause it to drop early
    • If dropping early as above, when it does so, it recalculates if it still needs to drop (did the player pick up the Blocker?). If so, it drops; if not, it recalculates as above appropriately
  • Power Poles can be damaged by Gusts. Need to make a 'wind damage' type
  • Bots that get hit by a Gust immediately turn into Item-On-Ground along with their cargo

We need a Wind system managing system that can:

  • Has an inventory that recieves Swept items
  • Can spawn / dissipate Gusts
  • Has a table that holds all of the RenderObjects to mimic swept items
  • Can evovle the Mimic's render properties
  • Can 'drop' the item where it lands, managing 'drop early from blocker' calculations as above
  • Can drop Bots and their cargo on the ground
  • Can interact with power poles
  • Has a list of Wind-Interactable Entities when they're built on the surface. It doesn't care what the interactions are.
    • As an aside, these will be things like Wind Turbines, Sand tiles, and maybe things like Flags that will whip in the wind. See [link to Osaul, someday]

Open Questions

  • What other entities should be influenced by Wind? And if so, how?
    • Any entity with an inventory can potentially have its contents Swept away.
    • Inserter hand contents, too
  • Should the player have some way of gathering sand?
  • What resource(s) should be in the sand? Should there be planet-specific entities to process it?
  • Is there stuff UNDER the sand that get revealed? (I so want this; ruins of some sort)