docs(reference): import Dune: Awakening server-manager references
Phase 2 references for the host-agent Dune adapter, moved out of volatile /tmp
into docs/reference-repos/ (per Commander). Three upstream projects, .git +
node_modules + compiled binaries stripped (16MB source). Nested AI-instruction
files (.claude/, CLAUDE.md) removed so they don't pollute Corrosion sessions.
- icehunter/ dune-admin (Go+React) — 4 control planes; SETUP_DOCKER.md is the
closest analog to our agent's Dune docker control plane (compose
lifecycle, docker logs, RabbitMQ-via-exec, dune Postgres schema)
- adainrivers/ Rust/Tauri desktop — SSH+k8s BattleGroup control, maintenance
daemon, in-game admin console (Rust idiom reference)
- the4rchangel/ Node web UI replacing battlegroup.bat — matches the Commander's
Hyper-V self-host path + game-config schema
See docs/reference-repos/README.md for the full index + how we use each.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
-- delete_spawner(in_map text, in_name text, in_dimension_index integer) -> void
|
||||
-- oid: 58230 kind: FUNCTION category: spawner
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.delete_spawner(in_map text, in_name text, in_dimension_index integer)
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
DELETE FROM actor_spawners WHERE map = in_map AND name = in_name AND dimension_index = in_dimension_index;
|
||||
END
|
||||
$function$
|
||||
@@ -0,0 +1,37 @@
|
||||
-- get_respawn_locations(in_account_id bigint) -> dune.respawnlocation[]
|
||||
-- oid: 58349 kind: FUNCTION category: spawner
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.get_respawn_locations(in_account_id bigint)
|
||||
RETURNS dune.respawnlocation[]
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
DECLARE
|
||||
result RespawnLocation[];
|
||||
BEGIN
|
||||
SELECT
|
||||
array_agg(
|
||||
(res.id,
|
||||
(
|
||||
CASE
|
||||
WHEN res.locator_transform IS NOT NULL THEN 'Transform'
|
||||
WHEN res.locator_actor_id IS NOT NULL THEN 'PersistentActor'
|
||||
WHEN res.locator_name IS NOT NULL THEN 'StaticLocatorName'
|
||||
END::SpawnLocatorType,
|
||||
res.locator_transform,
|
||||
res.locator_actor_id,
|
||||
res.locator_name,
|
||||
res.locator_name_index
|
||||
)::SpawnLocatorDescriptor,
|
||||
res.map,
|
||||
res.dimension,
|
||||
res.last_used_timestamp,
|
||||
res.group
|
||||
)::RespawnLocation
|
||||
)
|
||||
INTO result
|
||||
FROM player_respawn_locations res
|
||||
WHERE res.account_id = in_account_id;
|
||||
|
||||
RETURN result;
|
||||
END
|
||||
$function$
|
||||
@@ -0,0 +1,19 @@
|
||||
-- get_spawner_id(in_map text, in_name text, in_dimension_index integer) -> bigint
|
||||
-- oid: 58352 kind: FUNCTION category: spawner
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.get_spawner_id(in_map text, in_name text, in_dimension_index integer)
|
||||
RETURNS bigint
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
DECLARE
|
||||
spawner_id BIGINT;
|
||||
BEGIN
|
||||
SELECT INTO spawner_id "id" FROM actor_spawners WHERE map = in_map AND name = in_name AND dimension_index = in_dimension_index;
|
||||
IF spawner_id IS NULL THEN
|
||||
INSERT INTO actor_spawners("map", "name", "dimension_index") VALUES(in_map, in_name, in_dimension_index) ON CONFLICT DO NOTHING RETURNING "id" INTO spawner_id;
|
||||
IF spawner_id IS NULL THEN
|
||||
SELECT INTO spawner_id "id" FROM actor_spawners WHERE map = in_map AND name = in_name AND dimension_index = in_dimension_index;
|
||||
END IF;
|
||||
END IF;
|
||||
RETURN spawner_id;
|
||||
END $function$
|
||||
@@ -0,0 +1,66 @@
|
||||
-- update_respawn_locations(player_id bigint, respawn_locations dune.respawnlocation[]) -> void
|
||||
-- oid: 58632 kind: FUNCTION category: spawner
|
||||
|
||||
CREATE OR REPLACE FUNCTION dune.update_respawn_locations(player_id bigint, respawn_locations dune.respawnlocation[])
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
PERFORM 1
|
||||
FROM unnest(respawn_locations) AS loc
|
||||
WHERE
|
||||
(loc.locator).type != 'Invalid' AND NOT (
|
||||
(loc.locator).type = 'Transform' AND (loc.locator).transform IS NOT NULL AND (loc.locator).actor_id IS NULL AND (loc.locator).name IS NULL
|
||||
OR
|
||||
(loc.locator).type = 'PersistentActor' AND (loc.locator).actor_id IS NOT NULL AND (loc.locator).transform IS NULL AND (loc.locator).name IS NULL
|
||||
OR
|
||||
(loc.locator).type = 'StaticLocatorName' AND (loc.locator).name IS NOT NULL AND (loc.locator).transform IS NULL AND (loc.locator).actor_id IS NULL
|
||||
);
|
||||
|
||||
IF FOUND THEN
|
||||
RAISE EXCEPTION 'Invalid respawn location in input array. Check locator type and associated fields.';
|
||||
END IF;
|
||||
|
||||
WITH
|
||||
updated_respawn_locations AS (
|
||||
SELECT
|
||||
id,
|
||||
"group",
|
||||
(locator).transform AS locator_transform,
|
||||
(locator).actor_id AS locator_actor_id,
|
||||
(locator).name AS locator_name,
|
||||
(locator).name_index AS locator_name_index,
|
||||
map,
|
||||
dimension,
|
||||
last_used_timestamp
|
||||
FROM unnest(respawn_locations) AS updated
|
||||
),
|
||||
delete_missing_respawn_locations AS (
|
||||
DELETE FROM player_respawn_locations AS existing
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM updated_respawn_locations AS updated WHERE updated.id = existing.id
|
||||
)
|
||||
AND existing.account_id = player_id
|
||||
)
|
||||
INSERT INTO player_respawn_locations(
|
||||
"id", "account_id", "group", "locator_transform", "locator_actor_id", "locator_name", "locator_name_index", "map", "dimension", "last_used_timestamp"
|
||||
)
|
||||
SELECT
|
||||
up.id, player_id, up.group, up.locator_transform, up.locator_actor_id, up.locator_name, up.locator_name_index, up.map, up.dimension, up.last_used_timestamp
|
||||
FROM updated_respawn_locations AS up
|
||||
WHERE up.locator_actor_id IS NULL OR EXISTS (
|
||||
SELECT 1 FROM actors WHERE id = up.locator_actor_id
|
||||
)
|
||||
ON CONFLICT ("id", "account_id")
|
||||
DO UPDATE SET
|
||||
"account_id" = EXCLUDED.account_id,
|
||||
"group" = EXCLUDED.group,
|
||||
"locator_transform" = EXCLUDED.locator_transform,
|
||||
"locator_actor_id" = EXCLUDED.locator_actor_id,
|
||||
"locator_name" = EXCLUDED.locator_name,
|
||||
"locator_name_index" = EXCLUDED.locator_name_index,
|
||||
"map" = EXCLUDED.map,
|
||||
"dimension" = EXCLUDED.dimension,
|
||||
"last_used_timestamp" = EXCLUDED.last_used_timestamp;
|
||||
END;
|
||||
$function$
|
||||
Reference in New Issue
Block a user