v8.2.0b
Continued work on Wave Null + Added wipe mechanic, player deaths - Removed old method of checking if we're in a wave + Added the ability to get the core data directly within the plugin + Separated the default configs per game mode and automatically reset all values when the game mode changes
This commit is contained in:
@@ -21,13 +21,16 @@
|
|||||||
|
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
#pragma semicolon 1
|
#pragma semicolon 1
|
||||||
Database Get_Ass_Database(){
|
Database Get_Ass_Database() {
|
||||||
return Ass_Database;
|
return Ass_Database;
|
||||||
}
|
}
|
||||||
BOSSHANDLER Get_Boss_Handler(){
|
COREDATA GetCoreData() {
|
||||||
|
return core;
|
||||||
|
}
|
||||||
|
BOSSHANDLER Get_Boss_Handler() {
|
||||||
return BossHandler;
|
return BossHandler;
|
||||||
}
|
}
|
||||||
int GetGameMode(){
|
int GetGameMode() {
|
||||||
return core.gamemode;
|
return core.gamemode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +46,8 @@ public void OnPluginStart() {
|
|||||||
AssLogger(LOGLVL_INFO, "####### STARTUP SEQUENCE INITIATED... PREPARE FOR THE END TIMES #######");
|
AssLogger(LOGLVL_INFO, "####### STARTUP SEQUENCE INITIATED... PREPARE FOR THE END TIMES #######");
|
||||||
RegisterAndPrecacheAllFiles();
|
RegisterAndPrecacheAllFiles();
|
||||||
RegisterAllCommands();
|
RegisterAllCommands();
|
||||||
SetupCoreData();
|
UpdateGamemode();
|
||||||
|
if (core.gamemode == 0) SetupCoreData();
|
||||||
UpdateAllHealers();
|
UpdateAllHealers();
|
||||||
CreateTimer(1.0, UpdateMedicHealing);
|
CreateTimer(1.0, UpdateMedicHealing);
|
||||||
CPrintToChatAll("{darkred}Plugin Reloaded. If you do not hear music, please do !sounds and configure your preferences.");
|
CPrintToChatAll("{darkred}Plugin Reloaded. If you do not hear music, please do !sounds and configure your preferences.");
|
||||||
@@ -61,10 +65,10 @@ public void OnFastFire2Ready(){
|
|||||||
|
|
||||||
//Process ticks and requests in real time
|
//Process ticks and requests in real time
|
||||||
public void OnGameFrame() {
|
public void OnGameFrame() {
|
||||||
if (Enhancer_IsWave != core.isWave) Enhancer_IsWave = core.isWave;
|
|
||||||
if(WeatherManager.TornadoWarning) WeatherManager.TickSiren();
|
if(WeatherManager.TornadoWarning) WeatherManager.TickSiren();
|
||||||
if (AudioManager.shouldTick) AudioManager.TickBGM();
|
if (AudioManager.shouldTick) AudioManager.TickBGM();
|
||||||
if (BossHandler.shouldTick) BossHandler.Tick();
|
if (BossHandler.shouldTick) BossHandler.Tick();
|
||||||
if (BossHandler.tickBusterNuclear) BossHandler.TickBusterNuclear();
|
if (BossHandler.tickBusterNuclear) BossHandler.TickBusterNuclear();
|
||||||
|
if (core.gamemode == 2 && core.isWave) TickBodyCheck();
|
||||||
WeatherManager.TickFog();
|
WeatherManager.TickFog();
|
||||||
}
|
}
|
@@ -160,7 +160,7 @@ enum struct BOSSHANDLER {
|
|||||||
int eCount = 0;
|
int eCount = 0;
|
||||||
for (int i = 1; i <= MaxClients; i++) {
|
for (int i = 1; i <= MaxClients; i++) {
|
||||||
if (!IsClientInGame(i)) continue;
|
if (!IsClientInGame(i)) continue;
|
||||||
if (GetClientTeam(i) == TFTeam_Red && TF2_GetPlayerClass(i) == TFClass_Engineer) eCount++;
|
if (GetClientTeam(i) == 2 && TF2_GetPlayerClass(i) == TFClass_Engineer) eCount++;
|
||||||
}
|
}
|
||||||
int sCount = 0;
|
int sCount = 0;
|
||||||
int ent = -1
|
int ent = -1
|
||||||
@@ -170,7 +170,7 @@ enum struct BOSSHANDLER {
|
|||||||
SetEntProp(ent, Prop_Send, "m_iTeamNum", TFTeam_Blue);
|
SetEntProp(ent, Prop_Send, "m_iTeamNum", TFTeam_Blue);
|
||||||
SetEntPropEnt(ent, Prop_Data, "m_hOwnerEntity", 0);
|
SetEntPropEnt(ent, Prop_Data, "m_hOwnerEntity", 0);
|
||||||
}
|
}
|
||||||
if (GetEntProp(ent, Prop_Send, "m_iTeamNum") == TFTeam_Red) {
|
if (GetEntProp(ent, Prop_Send, "m_iTeamNum") == 2) {
|
||||||
sCount++;
|
sCount++;
|
||||||
PrintToChatAll("Found %i sentry guns. I'm watching your ass...", sCount);
|
PrintToChatAll("Found %i sentry guns. I'm watching your ass...", sCount);
|
||||||
if (sCount > eCount * 7){
|
if (sCount > eCount * 7){
|
||||||
@@ -274,7 +274,7 @@ enum struct BOSSHANDLER {
|
|||||||
CreateTimer(7.0, ResetTickBuster);
|
CreateTimer(7.0, ResetTickBuster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Tank buster thing
|
// Tank buster - Potato cannon edition!
|
||||||
void TickBusterNuclear(){
|
void TickBusterNuclear(){
|
||||||
float cPos[3]; //Client's Position
|
float cPos[3]; //Client's Position
|
||||||
float pPos[3]; //Ground Particle Target Position
|
float pPos[3]; //Ground Particle Target Position
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
//Fartsy's Scene Enhancer v1.0.0 (Inspired by Mrbt0907/Weather2Remastered)
|
//Fartsy's Scene Enhancer v1.0.0 (Inspired by Mrbt0907/Weather2Remastered)
|
||||||
|
|
||||||
bool Enhancer_IsWave;
|
|
||||||
//All background music
|
//All background music
|
||||||
enum struct BGM {
|
enum struct BGM {
|
||||||
char realPath[64];
|
char realPath[64];
|
||||||
@@ -327,7 +325,7 @@ enum struct WEATHERMANAGER {
|
|||||||
this.fogTarget = this.defFogDensity;
|
this.fogTarget = this.defFogDensity;
|
||||||
g_PowerOutage = false;
|
g_PowerOutage = false;
|
||||||
this.hasTornado = false;
|
this.hasTornado = false;
|
||||||
if(Enhancer_IsWave){
|
if(GetCoreData().isWave){
|
||||||
this.mIntensity = 5;
|
this.mIntensity = 5;
|
||||||
this.intensity = 7;
|
this.intensity = 7;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -65,6 +65,9 @@ enum struct COREDATA {
|
|||||||
bool tickMusic;
|
bool tickMusic;
|
||||||
bool tickBGMOffset;
|
bool tickBGMOffset;
|
||||||
char cachedPath[64];
|
char cachedPath[64];
|
||||||
|
char configDefault[72];
|
||||||
|
char configTacoBell[72];
|
||||||
|
char configWaveNull[72];
|
||||||
char songName[64];
|
char songName[64];
|
||||||
float HWNMin;
|
float HWNMin;
|
||||||
float HWNMax;
|
float HWNMax;
|
||||||
@@ -96,7 +99,6 @@ enum struct COREDATA {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
COREDATA core;
|
COREDATA core;
|
||||||
|
|
||||||
Database Ass_Database;
|
Database Ass_Database;
|
||||||
int attemptSpawn = 0;
|
int attemptSpawn = 0;
|
||||||
bool isGoobbue = false;
|
bool isGoobbue = false;
|
||||||
@@ -407,6 +409,9 @@ BULKFIRE crusaderAtk[64];
|
|||||||
//Configure all variables
|
//Configure all variables
|
||||||
void SetupCoreData(){
|
void SetupCoreData(){
|
||||||
AssLogger(LOGLVL_INFO, "Setting up core data...");
|
AssLogger(LOGLVL_INFO, "Setting up core data...");
|
||||||
|
strcopy(core.configDefault, sizeof(core.configDefault),"addons/sourcemod/configs/FartsysAss/Core/WaveDefaults.ini");
|
||||||
|
strcopy(core.configTacoBell, sizeof(core.configTacoBell),"addons/sourcemod/configs/FartsysAss/Core/WaveDefaults_TacoBell.ini");
|
||||||
|
strcopy(core.configWaveNull, sizeof(core.configWaveNull),"addons/sourcemod/configs/FartsysAss/Core/WaveDefaults_WaveNull.ini");
|
||||||
ass[0].name = "[10] Bath Salts";
|
ass[0].name = "[10] Bath Salts";
|
||||||
ass[1].name = "[20] Summon Goobbue or Kirby";
|
ass[1].name = "[20] Summon Goobbue or Kirby";
|
||||||
ass[2].name = "[30] Robot Trap (Wave Fail-safe)";
|
ass[2].name = "[30] Robot Trap (Wave Fail-safe)";
|
||||||
@@ -741,7 +746,7 @@ void SetupCoreData(){
|
|||||||
if (IsEndOfFile(confCoreData)) break;
|
if (IsEndOfFile(confCoreData)) break;
|
||||||
}
|
}
|
||||||
AssLogger(1, "[CORE] Setting up Wave Defaults...");
|
AssLogger(1, "[CORE] Setting up Wave Defaults...");
|
||||||
confCoreData = OpenFile("addons/sourcemod/configs/FartsysAss/Core/WaveDefaults.ini", "rt", false);
|
confCoreData = OpenFile(OVERRIDE_AND_GET_COREDATA(), "rt", false);
|
||||||
int defIndexHW, defIndexTornado, defIndexBGM, defIndexBS, defIndexBSM, defIndexSPM; // Start at 0 because we don't have a wave 0
|
int defIndexHW, defIndexTornado, defIndexBGM, defIndexBS, defIndexBSM, defIndexSPM; // Start at 0 because we don't have a wave 0
|
||||||
if(confCoreData == INVALID_HANDLE) return;
|
if(confCoreData == INVALID_HANDLE) return;
|
||||||
while (ReadFileLine(confCoreData, bufCoreData, sizeof(bufCoreData))){
|
while (ReadFileLine(confCoreData, bufCoreData, sizeof(bufCoreData))){
|
||||||
@@ -786,16 +791,19 @@ void SetupCoreData(){
|
|||||||
HookEventEx("player_hurt", Event_PlayerHurt, EventHookMode_Pre);
|
HookEventEx("player_hurt", Event_PlayerHurt, EventHookMode_Pre);
|
||||||
AssLogger(1, "Core data setup complete!");
|
AssLogger(1, "Core data setup complete!");
|
||||||
}
|
}
|
||||||
|
// Checks if the gamemode has changed, if it has, reinitialise all core data.
|
||||||
void UpdateGamemode(){
|
void UpdateGamemode(){
|
||||||
char logdata[256];
|
char logdata[192], popfile[128];
|
||||||
char popfile[128];
|
|
||||||
int ent = FindEntityByClassname(-1, "tf_objective_resource");
|
int ent = FindEntityByClassname(-1, "tf_objective_resource");
|
||||||
if (ent == -1) return;
|
if (ent == -1) return;
|
||||||
GetEntPropString(ent, Prop_Send, "m_iszMvMPopfileName", popfile, sizeof(popfile));
|
GetEntPropString(ent, Prop_Send, "m_iszMvMPopfileName", popfile, sizeof(popfile));
|
||||||
core.gamemode = (StrContains(popfile, "tacobell") != -1 ? 1 : (StrContains(popfile, "wavenull") != -1) ? 2 : 0);
|
int gamemode = (StrContains(popfile, "tacobell") != -1 ? 1 : (StrContains(popfile, "wavenull") != -1) ? 2 : 0);
|
||||||
Format(logdata, sizeof(logdata), "Testing if popfile contains tacobell or wavenull, result %i", core.gamemode);
|
if(core.gamemode != gamemode) {
|
||||||
|
Format(logdata, sizeof(logdata), "Current gamemode %i does not match detected gamemode %i! Someone must have changed the gamemode! Setting up core data immediately!!!", core.gamemode, gamemode);
|
||||||
AssLogger(LOGLVL_DEBUG, logdata);
|
AssLogger(LOGLVL_DEBUG, logdata);
|
||||||
|
core.gamemode = gamemode;
|
||||||
|
SetupCoreData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Messages to be printed when the fail safe has been triggered.
|
//Messages to be printed when the fail safe has been triggered.
|
||||||
char failsafe[][256] = {
|
char failsafe[][256] = {
|
||||||
@@ -1747,3 +1755,30 @@ void SendHudTextAll(int channel, const char[] text, float posX, float posY, floa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// WIPE MECHANIC - If all players die, the wave fails.
|
||||||
|
void TickBodyCheck() {
|
||||||
|
int alive = 0;
|
||||||
|
for (int i = 1; i <= MaxClients; i++) if (IsPlayerAlive(i) && GetClientTeam(i) == 2) alive++;
|
||||||
|
if (alive == 0) {
|
||||||
|
CPrintToChatAll("{red}You've all died! Are you happy?");
|
||||||
|
FastFire2("bots_win", "roundwin", "", 0.0, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Gets config file based on the game mode, we use the struct because returning differing array sizes is impossible otherwise.
|
||||||
|
char[] OVERRIDE_AND_GET_COREDATA() {
|
||||||
|
switch (core.gamemode) {
|
||||||
|
case 0: {
|
||||||
|
return core.configDefault;
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
return core.configTacoBell;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
return core.configWaveNull;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
LogError("Gamemode %i out of bounds. Reverting to defaults.", core.gamemode);
|
||||||
|
return core.configDefault;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -23,6 +23,7 @@ void sudo(int task) {
|
|||||||
float hwn = GetRandomFloat(core.HWNMin, core.HWNMax);
|
float hwn = GetRandomFloat(core.HWNMin, core.HWNMax);
|
||||||
CreateTimer(hwn, HWBosses);
|
CreateTimer(hwn, HWBosses);
|
||||||
AudioManager.ChangeBGM(core.tacobell ? tacoBellBGMIndex[core.curWave] : DefaultsArray[core.curWave].defBGMIndex);
|
AudioManager.ChangeBGM(core.tacobell ? tacoBellBGMIndex[core.curWave] : DefaultsArray[core.curWave].defBGMIndex);
|
||||||
|
PrintToChatAll("WARNING, AUDIOMANAGER'S CHANGEBGM FUNCTION IS DEPRECATED IN FAVOR OF THE NEW CONFIGS. FIX THIS IMMEDIATELY.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Force Tornado
|
//Force Tornado
|
||||||
|
Reference in New Issue
Block a user