#library "PioneerScripts.acs"
#include "zcommon.acs"
#import "CustomFunctions.acs"
#import "PickupScripts.acs"


Script "Pioneerclass_PickupSystem" (void)
{ 
   
   int plr = PlayerNumber();
   
   GiveInventory("PickupBlend", 1);
   PlaySound(0, "DSWPNUP", 4);
   
     switch(weaponnumbersave[plr])
  {
   case 1: GiveInventory("SFortWrench", 1); print(s:"\cfGot your Pipe! Time to make Dispensers!"); SetInventory("HasChainsaw", 1); break;
   case 2: GiveInventory("PioneerPlasmaShotgun", 1); print(s:"\cfYou got the Plasma Shredder! I mean it works..."); giveInventory("HasShotgun", 1); break;
   case 3: GiveInventory("PioneerSupershotgun", 1); print(s:"\cfPicked up the Punisher! Quad Barrel Terror!"); giveInventory("HasSuperShotgun", 1); break;
   case 4: GiveInventory("PioneerMachinegun", 1); print(s:"\cfPicked up the Portable Mini Gun 09! They Are Just Walking Targets!"); giveInventory("HasChaingun", 1); break;
   case 5: GiveInventory("PioneerSpreadCannon", 1); print(s:"\cfPicked up the Spread Cannon!"); giveInventory("HasRocketLauncher", 1); break;
   case 6: GiveInventory("PioneerPulseRifle", 1); print(s:"\cfPicked up the Pulse Rifle! Plasma Technology at its best!"); giveInventory("HasPlasmaRifle", 1); break;
   case 7: GiveInventory("PioneerOmegaSplicer", 1); print(s:"\cfPicked up the Omega Splicer 90k! Split them to atoms!"); giveInventory("HasBFG9000", 1); break;
   }
   
}

Script "PioneerClass_PistolStart" (void)
{
	TakeInventory("PioneerMachinegun", 1);
	TakeInventory("PioneerPlasmaShotgun", 1);
	TakeInventory("PioneerSupershotgun", 1);
	TakeInventory("SFortWrench", 1);
	TakeInventory("PioneerSpreadCannon", 1);
	TakeInventory("PioneerPulseRifle",1);
	TakeInventory("PioneerOmegaSplicer",1);
}

//The following stuff is ported from skullfort since the Doomfortress engineer sentry just detonates itself and doesn't work in a lot of mods. Please support the Skullfort devs for their mod!

Script "SentryPlacing" (void) CLIENTSIDE
{
	HudMessage(s:"Placing Sentry Gun...";HUDMSG_PLAIN,4707,CR_GOLD,1.5,0.5,0.06);
}

Script "SentryBuildingStart" (void) CLIENTSIDE
{
	Delay(1);
	ACS_NamedExecute("SentryBuilding",0);
}

Script "SentryBuilding" (void) CLIENTSIDE
{
	HudMessage(s:"Building Sentry Gun... 8";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 7";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 6";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 5";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 4";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 3";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 2";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 1";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,0.875);
}

Script "FastSentryBuildingStart" (void) CLIENTSIDE
{
	Delay(1);
	ACS_NamedExecute("FastSentryBuilding",0);
}

Script "FastSentryBuilding" (void) CLIENTSIDE
{
	HudMessage(s:"Building Sentry Gun... 4";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 3";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 2";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,1.125);
	Delay(35);
	HudMessage(s:"Building Sentry Gun... 1";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,0.875);
}

Script "SentryComplete" (void) CLIENTSIDE
{
	HudMessage(s:"Sentry Gun ready!";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,2.0);
}

Script "SentryDestroyed" (void) CLIENTSIDE
{
	Delay(2);
	ACS_NamedTerminate("SentryBuilding",0);
	HudMessage(s:"Sentry Gun destroyed!";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,3.0);
}

Script "SentryDestroyedGlobal" (void)
{
	Log(s:StrParam(n:PlayerNumber()),s:"'s Sentry Gun was destroyed!");
}

Script "SentryAmmoDepleted" (void) CLIENTSIDE
{
	HudMessage(s:"Sentry ammo depleted! Rebuild Sentry Gun!";HUDMSG_PLAIN,4706,CR_GOLD,1.5,0.425,3.0);
}

Script "SentryRemoverChecker" (void)
{
	if(CheckActorProperty(0,APROP_SPECIES,"Sentry"))
	{
		SetResultValue(1);
	}
	else
	{
		SetResultValue(0);
	}
}

Script "DispenserPlacing" (void) CLIENTSIDE
{
	HudMessage(s:"Placing Dispenser...";HUDMSG_PLAIN,4707,CR_GOLD,1.5,0.5,0.06);
}

Script "DispenserBuildingStart" (void) CLIENTSIDE
{
	Delay(1);
	ACS_NamedExecute("DispenserBuilding",0);
}

Script "DispenserBuilding" (void) CLIENTSIDE
{
	HudMessage(s:"Building Dispenser... 8";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 7";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 6";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 5";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 4";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 3";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 2";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 1";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,0.875);
}

Script "FastDispenserBuildingStart" (void) CLIENTSIDE
{
	Delay(1);
	ACS_NamedExecute("FastDispenserBuilding",0);
}

Script "FastDispenserBuilding" (void) CLIENTSIDE
{
	HudMessage(s:"Building Dispenser... 4";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 3";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 2";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,1.125);
	Delay(35);
	HudMessage(s:"Building Dispenser... 1";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,0.875);
}

Script "DispenserComplete" (void) CLIENTSIDE
{
	HudMessage(s:"Dispenser ready!";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,2.0);
}

Script "DispenserDestroyed" (void) CLIENTSIDE
{
	Delay(2);
	ACS_NamedTerminate("DispenserBuilding",0);
	HudMessage(s:"Dispenser destroyed!";HUDMSG_PLAIN,4709,CR_GOLD,1.5,0.3875,3.0);
}

Script "DispenserRemoverChecker" (void)
{
	if(CheckActorProperty(0,APROP_SPECIES,"Dispenser"))
	{
		SetResultValue(1);
	}
	else
	{
		SetResultValue(0);
	}
}

script "PioneerDispenserFriendlyMonsterFilter" (void)
{
    if (GetActorProperty(0, APROP_Friendly))
    {
        GiveInventory("Health", 5);
    }
}