static void SpawnSomething(WorldInst world, PosAng posAng) { float prob = Randomizer.GetFloat(); if (prob < BRScenario.VobSpotNPCProb) { SpawnNPC(world, posAng); } else if (prob < BRScenario.VobSpotNPCProb + BRScenario.VobSpotItemProb) { SpawnItem(world, posAng); } }
public static void JoinSpectate(ArenaClient client) { PosAng specPA = activeDef.SpecPA; foreach (var player in players) { if (player.Character != null && player.Character.IsSpawned) { specPA = new PosAng(player.Character.GetPosition(), player.Character.GetAngles()); specPA.Position.Y += 100; break; } } client.SetToSpectator(activeWorld, specPA.Position, specPA.Angles); }
static void SpawnItem(WorldInst world, PosAng posAng) { var item = BRScenario.Items.GetRandom(); ItemDef def = ItemDef.Get(item.Definition); if (def == null) { return; } ItemInst inst = new ItemInst(def); inst.SetAmount(item.Amount); inst.Spawn(world, posAng.Position, posAng.Angles); }
static void SpawnNPC(WorldInst world, PosAng posAng) { var npc = BRScenario.NPCs.GetRandom(); NPCDef def = NPCDef.Get(npc.Definition); if (def == null) { return; } NPCInst inst = new NPCInst(def); inst.BaseInst.SetNeedsClientGuide(true); inst.TeamID = 1; posAng.Position.Y += 50; inst.Protection = npc.Protection; inst.Damage = npc.Damage; inst.Spawn(world, posAng.Position, posAng.Angles); var agent = CreateAgent(); agent.Add(inst); }
public void Read(BinaryReaderEx br) { ptrMeshInfo = br.ReadUInt32(); ptrSkybox = br.ReadUInt32(); ptrTexArray = br.ReadUInt32(); numInstances = br.ReadInt32(); ptrInstances = br.ReadUInt32(); numModels = br.ReadInt32(); ptrModelsPtr = br.ReadUInt32(); unkptr3 = br.ReadUInt32(); unkptr4 = br.ReadUInt32(); ptrPickupHeadersPtrArray = br.ReadUInt32(); unkptr5 = br.ReadUInt32(); null1 = br.ReadInt32(); null2 = br.ReadInt32(); if (null1 != 0 || null2 != 0) { Console.WriteLine("WARNING header.null1 = " + null1 + "; header.null2 = " + null2); } cntWater = br.ReadUInt32(); ptrWater = br.ReadUInt32(); ptrNamedTex = br.ReadUInt32(); ptrNamedTexArray = br.ReadUInt32(); ptrRestartMain = br.ReadUInt32(); someData = new SomeData[3]; for (int i = 0; i < 3; i++) { SomeData sd = new SomeData(); sd.Read(br); someData[i] = sd; } startGrid = new PosAng[8]; for (int i = 0; i < 8; i++) { PosAng pos = new PosAng(br); startGrid[i] = pos; Console.WriteLine(startGrid[i].ToString()); } somePtr4 = br.ReadUInt32(); somePtr5 = br.ReadUInt32(); ptrLowTexArray = br.ReadUInt32(); backColor = new Vector4b(br); bgMode = br.ReadUInt32(); ptrBuildStart = br.ReadUInt32(); ptrBuildEnd = br.ReadUInt32(); ptrBuildType = br.ReadUInt32(); skip = br.ReadBytes(0x6C - 16 - 8 - 16); cntTrialData = br.ReadUInt32(); ptrTrialData = br.ReadUInt32(); cntu2 = br.ReadUInt32(); ptru2 = br.ReadUInt32(); cntSpawnPts = br.ReadUInt32(); ptrSpawnPts = br.ReadUInt32(); cntRestartPts = br.ReadUInt32(); ptrRestartPts = br.ReadUInt32(); //skip2 = br.ReadBytes(0x38); skip2 = br.ReadBytes(16); bgColor = new Vector4b[4]; for (int i = 0; i < 4; i++) { bgColor[i] = new Vector4b(br); } skip2_unkPtr = br.ReadUInt32(); cntVcolAnim = br.ReadUInt32();; ptrVcolAnim = br.ReadUInt32();; skip23 = br.ReadBytes(12); ptrAiNav = br.ReadUInt32(); skip3 = br.ReadBytes(0x24); long posx = br.BaseStream.Position; br.Jump(ptrBuildStart); compilationBegins = Helpers.ParseDate(br.ReadStringNT()); br.Jump(ptrBuildEnd); compilationEnds = Helpers.ParseDate(br.ReadStringNT()); br.Jump(ptrBuildType); Console.WriteLine(br.ReadStringNT()); br.Jump(posx); //Console.ReadKey(); }
protected override NPCInst SpawnCharacter(ArenaClient client, WorldInst world, PosAng spawnPoint) { NPCInst pc = base.SpawnCharacter(client, world, spawnPoint); pc.AllowHitTarget.Add(OnAllowHit); pc.DropUnconsciousOnDeath = true; pc.UnconsciousDuration = -1; return(pc); }
protected virtual NPCInst SpawnCharacter(ArenaClient client, WorldInst world, PosAng spawnPoint) { // only spawn if player has joined the game mode and chosen a class if (client == null || !client.GMJoined || client.GMClass == null) { return(null); } // get rid of old character if there is one client.KillCharacter(); NPCInst npc = CreateNPC(client.GMClass, (int)client.GMTeamID, client.CharInfo); npc.Spawn(world, spawnPoint.Position, spawnPoint.Angles); client.SetControl(npc); // start the warm up phase as soon as the first player joins if (Phase == GamePhase.None && players.Count(p => p.IsCharacter) == 1) { SetPhase(GamePhase.WarmUp); phaseTimer.SetInterval(Scenario.WarmUpDuration); phaseTimer.SetCallback(Fight); phaseTimer.Restart(); } return(npc); }
protected NPCInst SpawnCharacter(ArenaClient client, WorldInst world, PosAng spawnPoint, float range) { return(SpawnCharacter(client, world, new PosAng(Randomizer.GetVec3fRad(spawnPoint.Position, range), spawnPoint.Angles))); }