MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / AgentLoop

Method AgentLoop

modules/benchmarks-cs/ia_loop.cs:301–326  ·  view source on GitHub ↗
(
        ReducerContext ctx,
        GameEnemyAiAgentState agent,
        GameTargetableState agent_targetable,
        List<GameTargetableState> surrounding_agents,
        ulong current_time_ms
   

Source from the content-addressed store, hash-verified

299 }
300
301 public static void AgentLoop(
302 ReducerContext ctx,
303 GameEnemyAiAgentState agent,
304 GameTargetableState agent_targetable,
305 List<GameTargetableState> surrounding_agents,
306 ulong current_time_ms
307 )
308 {
309 ulong entity_id = agent.entity_id;
310
311 GameMobileEntityState? coordinates =
312 ctx.Db.game_mobile_entity_state.entity_id.Find(entity_id)
313 ?? throw new Exception("GameMobileEntityState Entity ID not found");
314
315 GameEnemyState agent_entity =
316 ctx.Db.game_enemy_state.entity_id.Find(entity_id)
317 ?? throw new Exception("GameEnemyState Entity ID not found");
318
319 GameHerdCache agent_herd =
320 ctx.Db.game_herd_cache.id.Find(agent_entity.herd_id)
321 ?? throw new Exception("GameHerdCache Entity ID not found");
322
323 SmallHexTile agent_herd_coordinates = agent_herd.location;
324
325 MoveAgent(ctx, ref agent, agent_herd_coordinates, current_time_ms);
326 }
327
328 [SpacetimeDB.Reducer]
329 public static void game_loop_enemy_ia(ReducerContext ctx, ulong players)

Callers

nothing calls this directly

Calls 1

FindMethod · 0.45

Tested by

no test coverage detected