Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Silly_Warlock: Made with advice from Iron Curtain code.
- class PickupSillyArmorShard extends PickupArmorShard;
- var float ArmorMultiplier;
- //S_W: Don't know what this one is about
- simulated static function UpdateHUD(HUD H)
- {
- H.LastPickupTime = H.Level.TimeSeconds;
- H.LastHealthPickupTime = H.LastPickupTime;
- }
- function bool UpgradeVehicle (Vehicle ToModify)
- {
- local InvVehicleNfo Nfo;
- local Inventory Inv;
- local int HpChange;
- local Controller C;
- //log(ToModify$" ArmorShard Hi ");
- if (ToModify == None)
- return false;
- Inv = ToModify.FindInventoryType(class'InvVehicleNfo');
- if (Inv == None)
- {
- //log(ToModify$" Making Nfo ");
- Nfo = ToModify.Spawn(class'InvVehicleNfo', ToModify,,,rot(0,0,0));
- //if (Nfo == None)
- //log(ToModify$" No Nfo -1 ");
- Nfo.GiveTo(ToModify);
- //if (Nfo == None)
- //log(ToModify$" No Nfo 0 ");
- }
- else
- {
- //log(ToModify$" Nfo already done "$Inv);
- Nfo = InvVehicleNfo(Inv);
- }
- if (Nfo == None)
- {
- log(ToModify$" Nfo lacking ");
- }
- HpChange = float(ArmorStrength) * ArmorMultiplier;
- ToModify.HealthMax += HpChange;
- ToModify.Health += HpChange;
- if (Nfo != None)
- {
- Nfo.CurrHpMax = ToModify.HealthMax;
- Nfo.ArmorBonus += HpChange;
- Nfo.PermaBonusHp += HpChange;
- }
- //If someone else is picking this up, then give threat to the crafter
- if (Crafter != None && Crafter.Pawn != None && ToModify.Controller != Crafter && Crafter.Pawn.Health > 0)
- {
- for (C = Level.ControllerList; C != None; C = C.NextController)
- {
- if (DWScriptedMonster(C.Pawn) == None || C.Pawn.Health <= 0)
- continue;
- C.Pawn.ModifyThreat(Threat, Crafter.Pawn);
- }
- }
- //log(ToModify$" "$ToModify.HealthMax);
- return true;
- }
- auto state Pickup
- {
- function bool ReadyToPickup(float MaxWait)
- {
- return true;
- }
- //ValidTouch()
- //Validate touch (if valid return true to let other pick me up and trigger event).
- function bool ValidTouch( actor Other )
- {
- // make sure its a live player
- if ( (Pawn(Other) == None) || (!Pawn(Other).bCanPickupInventory && (Vehicle(Other) == None || Vehicle(Other).Driver == None ) ) || (Pawn(Other).DrivenVehicle == None && Pawn(Other).Controller == None) )
- return false;
- // make sure not touching through wall
- if ( !FastTrace(Other.Location, Location) )
- return false;
- // make sure game will let player pick me up
- if( Level.Game.PickupQuery(Pawn(Other), self) )
- {
- TriggerEvent(Event, self, Pawn(Other));
- if( Vehicle(Other) == None && Pawn(Other) != None && Pawn(Other).DrivenVehicle == None )
- return CanPickupArmor(Pawn(Other));
- return true;
- }
- return false;
- }
- // When touched by an actor.
- function Touch( actor Other )
- {
- local Actor DrivenVehicle;
- if( ValidTouch(Other) )
- {
- DrivenVehicle = Other;
- //MutVehiclePickups workaround
- if( Vehicle(Other) == None && Pawn(Other) != None && Pawn(Other).DrivenVehicle != None )
- DrivenVehicle = Pawn(Other).DrivenVehicle;
- if( Vehicle(DrivenVehicle) != None )
- {
- if ( UpgradeVehicle (Vehicle(DrivenVehicle)) )
- {
- AnnouncePickup(Pawn(DrivenVehicle));
- SetRespawn();
- }
- }
- else if (GiveArmorTo(Pawn(Other)))
- {
- AnnouncePickup(Pawn(Other));
- SetRespawn();
- }
- }
- }
- // Make sure no pawn already touching (while touch was disabled in sleep).
- function CheckTouching()
- {
- local Pawn P;
- ForEach TouchingActors(class'Pawn', P)
- Touch(P);
- }
- function Timer()
- {
- if ( bDropped )
- GotoState('FadeOut');
- }
- function BeginState()
- {
- UntriggerEvent(Event, self, None);
- if ( bDropped )
- {
- AddToNavigation();
- //SetTimer(LifeTime, false);
- }
- }
- function EndState()
- {
- if ( bDropped )
- RemoveFromNavigation();
- }
- Begin:
- CheckTouching();
- }
- state FallingPickup
- {
- function CheckTouching()
- {
- }
- function bool ValidTouch( actor Other )
- {
- // make sure its a live player
- if ( (Pawn(Other) == None) || (!Pawn(Other).bCanPickupInventory && (Vehicle(Other) == None || Vehicle(Other).Driver == None ) ) || (Pawn(Other).DrivenVehicle == None && Pawn(Other).Controller == None) )
- return false;
- // make sure not touching through wall
- if ( !FastTrace(Other.Location, Location) )
- return false;
- // make sure game will let player pick me up
- if( Level.Game.PickupQuery(Pawn(Other), self) )
- {
- TriggerEvent(Event, self, Pawn(Other));
- if( Vehicle(Other) == None && Pawn(Other) != None && Pawn(Other).DrivenVehicle == None )
- return CanPickupArmor(Pawn(Other));
- return true;
- }
- return false;
- }
- // When touched by an actor.
- function Touch( actor Other )
- {
- local Actor DrivenVehicle;
- if( ValidTouch(Other) )
- {
- DrivenVehicle = Other;
- //MutVehiclePickups workaround
- if( Vehicle(Other) == None && Pawn(Other) != None && Pawn(Other).DrivenVehicle != None )
- DrivenVehicle = Pawn(Other).DrivenVehicle;
- if( Vehicle(DrivenVehicle) != None )
- {
- if ( UpgradeVehicle (Vehicle(DrivenVehicle)) )
- {
- AnnouncePickup(Pawn(DrivenVehicle));
- SetRespawn();
- }
- }
- else if (GiveArmorTo(Pawn(Other)))
- {
- AnnouncePickup(Pawn(Other));
- SetRespawn();
- }
- }
- }
- function Timer()
- {
- GotoState('FadeOut');
- }
- function BeginState()
- {
- //SetTimer(LifeTime, false);
- }
- function EndState()
- {
- SetPhysics(PHYS_Rotating);
- }
- }
- defaultproperties
- {
- ArmorMultiplier=1.0
- ArmorStrength=1
- MaxDesireability=1.250000
- PickupMessage="You found an armor shard."
- PickupSound=Sound'CicadaSnds.Missile.MissileEject'
- DrawType=DT_StaticMesh
- StaticMesh=StaticMesh'ME_RPGExpansionMeshes.Pickups.ArmorShard'
- Physics=PHYS_Rotating
- LifeSpan=300.000000
- RotationRate=(Yaw=24000)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement