feat(scripts): GF shooting gallery target script (SG_TARGET)

The cannon gives its targets scripts/ai/ACT/SG_TARGET.lua as their
custom_script_server, but their own script row is the empty script, which
won. A custom server script now replaces the empty script too, and the
target script is ported:

- explode factor 2.5 at startup;
- its score is its spawn data's (the cannon scores a hit with it);
- at the last waypoint of its path it tells the cannon (FinishedPath, the
  cannon spawns the next one, as after a hit) and, when its spawn data
  says so, dies silently 1 s later (2 s on a moving platform), which is
  no hit;
- at the other waypoints it may change speed (spawn data chance, whole
  numbers between its least and most speed; only an object following
  waypoints takes it).

The cannon's own end-of-path handling is gone; it now answers the
target's FinishedPath. The waypoint PlayAim action is not ported: no
path in the game has one. The spawn data has no time score.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-27 17:04:15 -06:00
parent b63f65ee5d
commit 5a863659ee
8 changed files with 155 additions and 41 deletions

View File

@@ -40,7 +40,7 @@ void ScriptComponent::LoadDataFromTemplate() {
m_ClientScriptName = row.client_script_name;
}
// custom_script_server replaces a missing server script; a client script (the row's or custom_script_client, or
// custom_script_server replaces a missing (or empty) server script; a client script (the row's or custom_script_client, or
// any object's without a server script) makes it a client script component
void ScriptComponent::LoadConfigData() {
if (!m_FromObject) return;
@@ -50,7 +50,9 @@ void ScriptComponent::LoadConfigData() {
const auto customScriptServer = m_Parent->GetVarAsString(u"custom_script_server");
if (!m_Parent->GetVarAsString(u"custom_script_client").empty()) client = true;
if (!customScriptServer.empty() && m_ScriptName.empty()) m_ScriptName = customScriptServer;
// The client's script component takes a custom script over its row's; here it replaces the row's only where that is
// the empty script (the GF shooting gallery targets: the cannon gives them SG_TARGET.lua)
if (!customScriptServer.empty() && (m_ScriptName.empty() || m_ScriptName == "scripts\\empty.lua")) m_ScriptName = customScriptServer;
m_Client = client && m_ScriptName.empty();
SetScript(m_ScriptName);