public void OnExitLevel2(Parameter para) { sendingscores = true; Log.Debug("Sending match stats..."); var winner = ""; switch (para.Type) { case VariableType.String: winner = para.As <string>(); break; case VariableType.Entity: if (para.As <Entity>().IsPlayer) { winner = para.As <Entity>().GetField <string>("name"); } break; } SendMessage("Match ended, level is exiting..."); SendMessage("Scoreboard (Winner is " + winner + "): "); //Log.Debug("Constructing match stats..."); BuildScores(); irc.ListenOnce(false); Thread.Sleep(500); sendingscores = false; Destroy(); }
public void OnExitLevel2(Parameter para) { sendingscores = true; Log.Debug("Sending match stats..."); var winner = ""; switch (para.Type) { case VariableType.String: winner = para.As<string>(); break; case VariableType.Entity: if (para.As<Entity>().IsPlayer) winner = para.As<Entity>().GetField<string>("name"); break; } SendMessage("Match ended, level is exiting..."); SendMessage("Scoreboard (Winner is " + winner + "): "); //Log.Debug("Constructing match stats..."); BuildScores(); irc.ListenOnce(false); Thread.Sleep(500); sendingscores = false; Destroy(); }
public static void onBotDamage(Entity hitbox, Parameter damage, Parameter attacker, Parameter direction_vec, Parameter point, Parameter meansOfDeath, Parameter modelName, Parameter partName, Parameter tagName, Parameter iDFlags, Parameter weapon) { //if (attacker.As<Entity>().Classname != "player") return; Entity currentBot = hitbox.GetField <Entity>("parent"); if (!botsInPlay.Contains(currentBot)) { return; } Entity player = (Entity)attacker; if ((string)weapon == "remote_uav_weapon_mp" && attacker.As <Entity>().HasField("owner"))//UAV tweaks { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; damage = 20; } else if ((string)weapon == "sentry_minigun_mp")//Sentry tweaks { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; damage = 10; } else if ((string)weapon == "manned_gl_turret_mp")//Sentry tweaks { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; damage = 300; } //Utilities.PrintToConsole((string)meansOfDeath); if ((string)weapon != "sentry_minigun_mp" && (string)weapon != "remote_uav_weapon_mp" && (string)meansOfDeath != "MOD_EXPLOSIVE_BULLET") { PlayFX(fx_blood, point.As <Vector3>()); //Only play FX if the weapon isn't a script weapon } doBotDamage((int)damage, player, (string)weapon, hitbox, (string)meansOfDeath, point.As <Vector3>()); string botState = currentBot.GetField <string>("state"); if (botState != "hurt" && botState != "attacking" && (string)meansOfDeath != "MOD_BLEEDOUT") { if (currentBot.GetField <string>("type") == "tower") { playAnimOnBot(currentBot, botAnims["tower_run_hurt"]); } else { playAnimOnBot(currentBot, botAnims["run_hurt"]); } currentBot.SetField("state", "hurt"); AfterDelay(500, () => { if (currentBot.GetField <string>("state") != "dead") { currentBot.SetField("state", "post_hurt"); } }); } if (hitbox.GetField <int>("damageTaken") >= hitbox.GetField <int>("currentHealth")) { currentBot.SetField("isAlive", false); currentBot.SetField("state", "dead"); hitbox.SetCanDamage(false); hitbox.SetCanRadiusDamage(false); hitbox.SetModel("tag_origin");//Change model to avoid the dead bot's hitbox blocking shots if (player.Classname == "player") { int pointGain = 20; if ((string)meansOfDeath == "MOD_HEADSHOT") { pointGain = 50; } scorePopup(player, pointGain); addRank(player, pointGain); player.Kills++; if (player.HasField("specialty_triggerhappy") && (string)weapon == player.CurrentWeapon) { int ammoInClip = player.GetWeaponAmmoClip(player.CurrentWeapon); int clipSize = WeaponClipSize(player.CurrentWeapon); int difference = clipSize - ammoInClip; int ammoReserves = player.GetWeaponAmmoStock(player.CurrentWeapon); if (ammoInClip != clipSize && ammoReserves > 0) { if (ammoInClip + ammoReserves >= clipSize) { player.SetWeaponAmmoClip(player.CurrentWeapon, clipSize); player.SetWeaponAmmoStock(player.CurrentWeapon, (ammoReserves - difference)); } else { player.SetWeaponAmmoClip(player.CurrentWeapon, ammoInClip + ammoReserves); if (ammoReserves - difference > 0) { player.SetWeaponAmmoStock(player.CurrentWeapon, (ammoReserves - difference)); } else { player.SetWeaponAmmoStock(player.CurrentWeapon, 0); } } } } } currentBot.MoveTo(currentBot.Origin, 0.05f); spawnBotRagdoll(currentBot, (string)meansOfDeath, point.As <Vector3>()); despawnBot(currentBot); botsInPlay.Remove(currentBot); roundUtil.checkForEndRound(); } }
public static void onBotDamage(Entity hitbox, Parameter damage, Parameter attacker, Parameter direction_vec, Parameter point, Parameter meansOfDeath, Parameter modelName, Parameter partName, Parameter tagName, Parameter iDFlags, Parameter weapon, bool isCrawler, bool isBoss) { if ((string)weapon == "iw5_usp45_mp_akimbo_silencer02" || AIZ.isRayGun((string)weapon)) { return; } Entity currentBot = hitbox.GetField <Entity>("parent"); if (!botsInPlay.Contains(currentBot)) { return; } Entity player = (Entity)attacker; if ((string)weapon == "remote_uav_weapon_mp" && attacker.As <Entity>().HasField("owner"))//UAV tweaks { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; damage = 50; } else if ((string)weapon == "sentry_minigun_mp")//Sentry tweaks { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; damage = 10; } else if ((string)weapon == "manned_gl_turret_mp")//Sentry tweaks { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; damage = 300; } else if ((string)weapon == "remote_tank_projectile_mp" || (string)weapon == "uav_strike_projectile_mp") { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; } else if ((string)weapon == "ac130_25mm_mp")//A10 tweaks { //player = attacker.As<Entity>().GetField<Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; } //Utilities.PrintToConsole((string)meansOfDeath); if ((string)meansOfDeath == "MOD_BLEEDOUT") { Vector3 org = currentBot.GetTagOrigin("j_head"); PlayFX(AIZ.fx_headshotBlood, org); doBotDamage((int)damage, player, (string)weapon, hitbox, (string)meansOfDeath, point.As <Vector3>(), true); } else { if ((string)weapon != "sentry_minigun_mp" && (string)weapon != "manned_gl_turret_mp" && (string)weapon != "remote_uav_weapon_mp" && (string)meansOfDeath != "MOD_EXPLOSIVE_BULLET") { PlayFX(AIZ.fx_blood, point.As <Vector3>()); //Only play FX if the weapon isn't a script weapon } doBotDamage((int)damage, player, (string)weapon, hitbox, (string)meansOfDeath, point.As <Vector3>()); } string botState = currentBot.GetField <string>("state"); if (botState != "hurt" && botState != "attacking" && (string)meansOfDeath != "MOD_BLEEDOUT") { if (!isCrawler && !isBoss) { playAnimOnBot(currentBot, getHurtAnim(hitbox)); } else if (isBoss) { playAnimOnBot(currentBot, anim_runHurt); } currentBot.SetField("state", "hurt"); AfterDelay(500, () => currentBot.SetField("state", "post_hurt")); } updateBotLastActiveTime(currentBot); if (hitbox.GetField <int>("damageTaken") >= hitbox.GetField <int>("currentHealth")) { currentBot.SetField("isAlive", false); if (currentBot.HasField("isOnCompass") && currentBot.GetField <bool>("isOnCompass")) { /* * Objective_Delete(currentBot.GetField<int>("compassID")); * h_mapEdit._objIDList[currentBot.GetField<int>("compassID")] = false; * h_mapEdit._objIDs.Remove(currentBot); * currentBot.ClearField("compassID"); */ mapEdit.removeObjID(currentBot); currentBot.SetField("isOnCompass", false); } hitbox.SetCanDamage(false); hitbox.SetCanRadiusDamage(false); hitbox.SetModel("tag_origin");//Change model to avoid the dead bot's hitbox blocking shots //if (isBoss) hitbox.Delete(); if (AIZ.isPlayer(player)) { if (currentBot.HasField("primedForNuke") && !currentBot.GetField <bool>("primedForNuke")) { int pointGain = 50; if ((string)meansOfDeath == "MOD_HEADSHOT") { pointGain = 100; } if ((string)meansOfDeath == "MOD_MELEE") { pointGain = 130; } if (doublePointsTime > 0) { pointGain *= 2; } if ((string)meansOfDeath != "MOD_PASSTHRU") { player.SetField("cash", player.GetField <int>("cash") + pointGain); hud.scorePopup(player, pointGain); } AIZ.addRank(player, pointGain); } player.Kills++; if (player.HasField("aizHud_created")) { player.SetField("points", player.GetField <int>("points") + 1); HudElem pointNumber = player.GetField <HudElem>("hud_pointNumber"); pointNumber.SetValue(player.GetField <int>("points")); } killstreaks.checkKillstreak(player); } currentBot.MoveTo(currentBot.Origin, 0.05f); if (isCrawler || currentBot.HasField("hasBeenCrippled")) { playAnimOnBot(currentBot, crawlerAnim_death); } else { //Log.Write(LogLevel.All, (string)meansOfDeath); /* * if ((string)meansOfDeath == "MOD_EXPLOSIVE" || (string)meansOfDeath == "MOD_GRENADE_SPLASH") * { * currentBot.Angles = VectorToAngles(point.As<Vector3>() - currentBot.Origin); * int randomAnim = g_AIZ.rng.Next(anim_death_explode.Length); * currentplayAnimOnBot(bot, anim_death_explode[randomAnim]); * } * else */ //{ int randomAnim = AIZ.rng.Next(anim_deaths.Length); playAnimOnBot(currentBot, anim_deaths[randomAnim]); //} } if (currentBot.HasField("hasBeenCrippled")) { currentBot.ClearField("hasBeenCrippled"); } if (isCrawler) { AfterDelay(500, () => currentBot.MoveTo(currentBot.Origin + new Vector3(0, 0, 2500), 5)); } AfterDelay(5000, () => despawnBot(currentBot, isCrawler, isBoss)); botsInPlay.Remove(currentBot); onBotUpdate(); roundSystem.checkForEndRound(); if (isCrawler && roundSystem.isCrawlerWave && (botsInPlay.Count == 0 && botsForWave == spawnedBots) && perkDropsEnabled && AIZ.isHellMap) { bonusDrops.spawnBonusDrop(bonusDrops.dropTypes.perk, currentBot.Origin); return; } if (!isBoss) { bonusDrops.dropTypes bonusType = bonusDrops.checkForBonusDrop(); if (bonusType != bonusDrops.dropTypes.none) { bonusDrops.spawnBonusDrop(bonusType, currentBot.Origin); } } } }