quake2ts 0.0.479 → 0.0.480

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26037,16 +26037,16 @@ function dropFlag(flag, origin, game, context) {
26037
26037
  flag.owner = null;
26038
26038
  flag.solid = 1 /* Trigger */;
26039
26039
  flag.model = flag.flagTeam === "red" ? "players/male/flag1.md2" : "players/male/flag2.md2";
26040
- const time = context.timeSeconds ?? game.time;
26040
+ const time = context.timeSeconds;
26041
26041
  flag.nextthink = time + 30;
26042
- game.centerprintf?.(flag, `The ${flag.flagTeam} flag was dropped!`);
26043
- flag.think = (selfEntity, ctx) => flagThink(selfEntity, ctx, game);
26042
+ context.engine.centerprintf?.(flag, `The ${flag.flagTeam} flag was dropped!`);
26043
+ flag.think = (selfEntity, ctx) => flagThink(selfEntity, ctx);
26044
26044
  }
26045
- function flagThink(self, context, game) {
26045
+ function flagThink(self, context) {
26046
26046
  const flag = self;
26047
26047
  if (flag.flagState === 2 /* DROPPED */) {
26048
- game.sound?.(flag, 0, "ctf/flagret.wav", 1, 1, 0);
26049
- game.centerprintf?.(flag, `The ${flag.flagTeam} flag returned to base!`);
26048
+ context.sound(flag, 0, "ctf/flagret.wav", 1, 1, 0);
26049
+ context.engine.centerprintf?.(flag, `The ${flag.flagTeam} flag returned to base!`);
26050
26050
  setFlagState(flag, 0 /* AT_BASE */, context);
26051
26051
  flag.origin = { ...flag.baseOrigin };
26052
26052
  flag.solid = 1 /* Trigger */;
@@ -26060,17 +26060,18 @@ function checkPlayerFlagDrop(player, sys) {
26060
26060
  const hasRedFlag = hasKey(player.client.inventory, "key_red_flag" /* RedFlag */);
26061
26061
  const hasBlueFlag = hasKey(player.client.inventory, "key_blue_flag" /* BlueFlag */);
26062
26062
  if (!hasRedFlag && !hasBlueFlag) return;
26063
+ let foundFlag = null;
26063
26064
  sys.forEachEntity((ent) => {
26064
26065
  const flag = ent;
26065
26066
  if ((flag.classname === "item_flag_team1" || flag.classname === "item_flag_team2") && flag.owner === player) {
26066
- const game = sys._game;
26067
- if (game) {
26068
- dropFlag(flag, player.origin, game, sys);
26069
- player.client.inventory.keys.delete("key_red_flag" /* RedFlag */);
26070
- player.client.inventory.keys.delete("key_blue_flag" /* BlueFlag */);
26071
- }
26067
+ foundFlag = flag;
26072
26068
  }
26073
26069
  });
26070
+ if (foundFlag) {
26071
+ dropFlag(foundFlag, player.origin, null, sys);
26072
+ player.client.inventory.keys.delete("key_red_flag" /* RedFlag */);
26073
+ player.client.inventory.keys.delete("key_blue_flag" /* BlueFlag */);
26074
+ }
26074
26075
  }
26075
26076
 
26076
26077
  // src/entities/player.ts