Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auras (sensor extension?) #1508

Open
sprunk opened this issue May 12, 2024 · 0 comments
Open

Auras (sensor extension?) #1508

sprunk opened this issue May 12, 2024 · 0 comments
Labels
enhancement New feature or request Lua API

Comments

@sprunk
Copy link
Collaborator

sprunk commented May 12, 2024

Background

Lua is pretty bad at doing spatial tasks (tracking units in zones, raycasting over terrain etc). The engine could have native support for this kind of work and in fact it may be a matter of extending existing sensor interface. Zones around units are of course auras and many things can be elegantly achieved with them that currently require manually polling and keeping track of units (ZK area cloaking, BAR raptor acid puddles, the BAR idea to have T2 radar remove wobble, etc).

Core design

Have the engine read gamedata/auraDefs.lua which defines an array of aura types.

  • string name
  • bool, whether ignores terrain
  • bool, 3d vs 2d
  • bool, applies to units directly or via ground
  • bool, affects self/allies/enemies/neutrals/features(/projectiles??)
  • bool, tracked per individual aura carrier or common (like radar)
  • bool, per team vs allyteam

Have unit defs for a unit to provide auras. Something like

auras = {
  -- name = { radius = number, strength = integer },
  radar = { radius = 1234, strength = 5 },
  devotion = { radius = 500, strength = 3 },
},

Have a bunch of appropriate callins:

  • wupget:UnitEnteredIndividualAura(auraID, unitID, carrierID, strength, totalStrength)
  • wupget:UnitLeftIndividualAura(auraID, unitID, carrierID, strength, totalStrength)
  • wupget:UnitAuraStrengthChanged(auraID, unitID, auraTeamID, oldStrength, newStrength)
  • etc.

Have callouts:

  • Spring.SetAuraStrength(unitID, auraID, strength) -> nil
  • Spring.SetAuraRadius(unitID, auraID, radius) -> nil
  • Spring.GetAuraStrength(unitID, auraID) -> strength
  • Spring.GetAuraRadius(unitID, auraID) -> radius
  • Spring.AddStandaloneAura() -> auraEmitterID (see [FR] Add a way to grant local LoS #1000 sensors)
@sprunk sprunk added enhancement New feature or request Lua API labels May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Lua API
Projects
None yet
Development

No branches or pull requests

1 participant