Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1.1
- class ArtifactCraftWeapon extends ArtifactCraftAutoTurret;
- var bool bIsFree;
- var bool bIsDropped;
- var bool bSuccess;
- var PickUp Changeling;
- var class<PickUp> ChangelingClass;
- function bool GetUsability()
- {
- //Can't use this if you don't have enough adrenaline...
- if (Instigator.Controller.Adrenaline < GetCost() )
- {
- Instigator.ReceiveLocalizedMessage(MessageClass, GetCost(), None, None, Class);
- return false;
- }
- //Can't use this if we don't have scrap metal
- if (InvMetal.ScrapMetal[0] <= 0 && InvMetal.ScrapMetal[1] <= 0 && InvMetal.ScrapMetal[2] <= 0 && InvMetal.ScrapMetal[3] <= 0 && InvMetal.ScrapMetal[4] <= 0)
- {
- Instigator.ReceiveLocalizedMessage(MessageClass, 1000, None, None, Class);
- return false;
- }
- return true;
- }
- function AltActivate(optional string Param)
- {
- local float TimeDelta;
- local Vector StartTrace, EndTrace, SpawnLocation, HitNormal;
- if (Param != "")
- WeaponClass = class<Weapon>(DynamicLoadObject(Param, class'Class'));
- if (Instigator == None)
- {
- Destroy();
- return;
- }
- if (bIsFree != true)
- {
- if (GetUsability() != true)
- {
- bActive = false;
- GotoState('');
- return;
- }
- }
- //Check to see if we are allowed to use this again by time.
- TimeDelta = Level.TimeSeconds - LastUseTime;
- if (Level.TimeSeconds - LastUseTime < UseDelay)
- {
- Instigator.ReceiveLocalizedMessage(MessageClass, 5000 + UseDelay - TimeDelta, None, None, Class);
- bActive = false;
- GotoState('');
- return;
- }
- LastUseTime = Level.TimeSeconds;
- StartTrace = Instigator.Location;
- EndTrace = Instigator.Location + vector(Instigator.Rotation) * Instigator.GroundSpeed;
- if (Instigator.Trace(SpawnLocation, HitNormal, EndTrace, Instigator.Location) != None)
- {
- SpawnLocation -= vector(Instigator.Rotation) * 40;
- A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, SpawnLocation, Instigator.Rotation);
- }
- else
- A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, EndTrace, Instigator.Rotation);
- if (A != None)
- {
- A.bHidden = true;
- Changeling = spawn(ChangelingClass,,, A.Location, A.Rotation);
- if (WeaponClass == None)
- WeaponClass = Class'DWU2Weapons.WeaponRocketTurret';
- if (WeaponClass == class'LinkGun')
- WeaponClass = Class'MonsterAssaultRPG.RPGLinkGun';
- A.bDelayedSpawn = true;
- A.WeaponType=WeaponClass;
- A.PostBeginPlay();
- SetTimer(1,false);
- }
- }
- function Timer()
- {
- local int i;
- local PickUp WeaponPickUp;
- if (A.myPickUp != None)
- WeaponPickUp = A.myPickUp;
- if (Changeling != None)
- Changeling.Destroy();
- A.Destroy();
- if (WeaponPickUp != None)
- {
- ModifyPickUp (WeaponPickUp);
- //cost
- if (!bIsFree && bSuccess)
- PayUp ();
- }
- }
- function ModifyPickup (PickUp TMWeaponPickUp)
- {
- TMWeaponPickUp.GotoState( 'Pickup' );
- TMWeaponPickUp.RespawnTime = 0;
- TMWeaponPickUp.bDropped = bIsDropped;
- TMWeaponPickUp.RespawnEffect();
- ////TMWeaponPickUp.AmmoAmount = GetAmmo();
- if (!TMWeaponPickUp.bDropped)
- TMWeaponPickUp.Lifespan = 120;
- TMWeaponPickUp.SetTimer(120, false);
- TMWeaponPickUp.NetUpdateTime = Level.TimeSeconds - 1;
- TMWeaponPickUp.bHidden = false;
- bSuccess = true;
- }
- function PayUp ()
- {
- local int i;
- Instigator.Controller.Adrenaline -= GetCost();
- if (Instigator.Controller.Adrenaline < 0)
- Instigator.Controller.Adrenaline = 0;
- //Remove scrap metal
- i = 4;
- while (InvMetal.ScrapMetal[i] <= 0 && i >= 0)
- i--;
- InvMetal.RemoveMetal(i);
- }
- defaultproperties
- {
- ChangelingClass=Class'SillyRPG.XIsAChangeling'
- AbilityLevel=1
- UseDelay=2
- WeaponClass=Class'DWU2Weapons.AutoTurretDeploy'
- bIsFree=true
- bIsDropped=false
- MinActivationTime=0.000001
- ActivateSound=Sound'WeaponSounds.BaseGunTech.BReload2'
- IconMaterial=Texture'ME_RPGExpansion.Icons.CraftSpiderMines'
- ItemName="Craft Weapon"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement