| 192 | } |
| 193 | |
| 194 | [SpacetimeDB.Reducer] |
| 195 | public static void insert_world(ReducerContext ctx, ulong players) |
| 196 | { |
| 197 | for (ulong i = 0; i < players; i++) |
| 198 | { |
| 199 | ulong next_action_timestamp = |
| 200 | (i & 2) == 2 ? MomentMilliseconds() + 2000 : MomentMilliseconds(); |
| 201 | |
| 202 | ctx.Db.game_enemy_ai_agent_state.Insert( |
| 203 | new(i, [i, 0, i * 2], next_action_timestamp, AgentAction.Idle) |
| 204 | ); |
| 205 | |
| 206 | ctx.Db.game_live_targetable_state.Insert(new(i, (long)i)); |
| 207 | |
| 208 | ctx.Db.game_targetable_state.Insert(new(i, (long)i)); |
| 209 | |
| 210 | ctx.Db.game_mobile_entity_state.Insert(new(i, (int)i, (int)i, next_action_timestamp)); |
| 211 | |
| 212 | ctx.Db.game_enemy_state.Insert(new(i, (int)i)); |
| 213 | |
| 214 | ctx.Db.game_herd_cache.Insert( |
| 215 | new( |
| 216 | (int)i, |
| 217 | (uint)i, |
| 218 | (int)(i * 2), |
| 219 | new SmallHexTile((int)i, (int)i, (uint)(i * 2)), |
| 220 | (int)(i * 4), |
| 221 | i, |
| 222 | (int)i |
| 223 | ) |
| 224 | ); |
| 225 | } |
| 226 | Log.Info($"INSERT WORLD PLAYERS: {players}"); |
| 227 | } |
| 228 | |
| 229 | public static List<GameTargetableState> GetTargetablesNearQuad( |
| 230 | ReducerContext ctx, |