Added tesla boost capabilities.

Shock troopers and tesla tanks standing near a tesla coil
will charge it up, enhancing its range, modifying the zap
animation and allowing it to work even when player's power
is down.
The sound for charger weapons edited from
https://www.freesound.org/people/JoelAudio/sounds/136542/
This commit is contained in:
Matija Hustić
2015-06-16 22:49:41 +01:00
parent 50679cd6c4
commit 03c80fb9c6
8 changed files with 96 additions and 5 deletions

View File

@@ -13,23 +13,24 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("Needs power to operate.")] [Desc("Needs power to operate.")]
class RequiresPowerInfo : ITraitInfo class RequiresPowerInfo : UpgradableTraitInfo, ITraitInfo
{ {
public object Create(ActorInitializer init) { return new RequiresPower(init.Self); } public override object Create(ActorInitializer init) { return new RequiresPower(init.Self, this); }
} }
class RequiresPower : IDisable, INotifyOwnerChanged class RequiresPower : UpgradableTrait<RequiresPowerInfo>, IDisable, INotifyOwnerChanged
{ {
PowerManager playerPower; PowerManager playerPower;
public RequiresPower(Actor self) public RequiresPower(Actor self, RequiresPowerInfo info)
: base(info)
{ {
playerPower = self.Owner.PlayerActor.Trait<PowerManager>(); playerPower = self.Owner.PlayerActor.Trait<PowerManager>();
} }
public bool Disabled public bool Disabled
{ {
get { return playerPower.PowerProvided < playerPower.PowerDrained; } get { return playerPower.PowerProvided < playerPower.PowerDrained && !IsTraitDisabled; }
} }
public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)

BIN
mods/ra/bits/litningupg.shp Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -475,6 +475,17 @@ SHOK:
Armament@GARRISONED: Armament@GARRISONED:
Name: garrisoned Name: garrisoned
Weapon: PortaTesla Weapon: PortaTesla
Armament@CHARGE:
Weapon: PortaCharge
LocalOffset: 427,0,341
TargetStances: Ally
ForceTargetStances: None
Cursor: ability
OutsideRangeCursor: ability
AmmoPool:
PipCount: 0
SelfReloads: true
SelfReloadTicks: 70
AttackFrontal: AttackFrontal:
Voice: Attack Voice: Attack
AttackMove: AttackMove:

View File

@@ -387,6 +387,9 @@ TSLA:
Footprint: _ x Footprint: _ x
Dimensions: 1,2 Dimensions: 1,2
RequiresPower: RequiresPower:
UpgradeTypes: tesla
UpgradeMaxEnabledLevel: 2
UpgradeMaxAcceptedLevel: 3
Selectable: Selectable:
Bounds: 24,24,0,16 Bounds: 24,24,0,16
SelectionDecorations: SelectionDecorations:
@@ -403,8 +406,17 @@ TSLA:
HasMinibib: Yes HasMinibib: Yes
WithChargeAnimation: WithChargeAnimation:
Armament: Armament:
UpgradeTypes: tesla
UpgradeMaxEnabledLevel: 1
UpgradeMaxAcceptedLevel: 3
Weapon: TeslaZap Weapon: TeslaZap
LocalOffset: 0,0,427 LocalOffset: 0,0,427
Armament@Upgraded:
UpgradeTypes: tesla
UpgradeMinEnabledLevel: 2
UpgradeMaxAcceptedLevel: 3
Weapon: TeslaZap.Upgraded
LocalOffset: 0,0,427
AttackCharge: AttackCharge:
ChargeAudio: tslachg2.aud ChargeAudio: tslachg2.aud
MaxCharges: 3 MaxCharges: 3
@@ -414,6 +426,8 @@ TSLA:
DetectCloaked: DetectCloaked:
Range: 8c0 Range: 8c0
ProvidesPrerequisite@buildingname: ProvidesPrerequisite@buildingname:
Targetable:
TargetTypes: Ground, C4, DetonateAttack, Structure, TeslaBoost
AGUN: AGUN:
Inherits: ^Defense Inherits: ^Defense

View File

@@ -563,6 +563,17 @@ TTNK:
Armament: Armament:
Weapon: TTankZap Weapon: TTankZap
LocalOffset: 0,0,213 LocalOffset: 0,0,213
Armament@charge:
Weapon: TTankCharge
LocalOffset: 0,0,213
TargetStances: Ally
ForceTargetStances: None
Cursor: ability
OutsideRangeCursor: ability
AmmoPool:
PipCount: 0
SelfReloads: true
SelfReloadTicks: 120
AttackFrontal: AttackFrontal:
WithIdleOverlay@SPINNER: WithIdleOverlay@SPINNER:
Sequence: spinner Sequence: spinner

View File

@@ -160,6 +160,13 @@ litning:
Start: 4 Start: 4
Length: 4 Length: 4
litningupg:
bright:
Length: 4
dim: litning
Start: 4
Length: 4
fb1: fb1:
idle: idle:
Length: * Length: *

View File

@@ -151,6 +151,21 @@ TeslaZap:
Wood: 60 Wood: 60
DamageTypes: Prone50Percent, TriggerProne, ElectricityDeath DamageTypes: Prone50Percent, TriggerProne, ElectricityDeath
TeslaZap.Upgraded:
ReloadDelay: 3
Charges: true
Range: 9c512
Report: TESLA1.AUD
Projectile: TeslaZap
Image: litningupg
Warhead@1Dam: SpreadDamage
Spread: 42
Damage: 120
Versus:
None: 1000
Wood: 60
DamageTypes: Prone50Percent, TriggerProne, ElectricityDeath
PortaTesla: PortaTesla:
ReloadDelay: 70 ReloadDelay: 70
Range: 6c0 Range: 6c0
@@ -164,6 +179,22 @@ PortaTesla:
None: 1000 None: 1000
DamageTypes: Prone50Percent, TriggerProne, ElectricityDeath DamageTypes: Prone50Percent, TriggerProne, ElectricityDeath
PortaCharge:
ReloadDelay: 70
Range: 2c0
Report: teslacharge.aud
Charges: yes
ValidStances: Ally
ValidTargets: TeslaBoost
Projectile: TeslaZap
Image: litningupg
Warhead@charge: GrantUpgrade
Range: 42
Duration: 75
Upgrades: tesla
ValidStances: Ally
ValidTargets: TeslaBoost
TTankZap: TTankZap:
ReloadDelay: 120 ReloadDelay: 120
Range: 7c0 Range: 7c0
@@ -177,6 +208,22 @@ TTankZap:
None: 1000 None: 1000
DamageTypes: Prone50Percent, TriggerProne, ElectricityDeath DamageTypes: Prone50Percent, TriggerProne, ElectricityDeath
TTankCharge:
ReloadDelay: 120
Range: 2c0
Report: teslacharge.aud
Charges: yes
ValidStances: Ally
ValidTargets: TeslaBoost
Projectile: TeslaZap
Image: litningupg
Warhead@charge: GrantUpgrade
Range: 42
Duration: 125
Upgrades: tesla, tesla, tesla
ValidStances: Ally
ValidTargets: TeslaBoost
DogJaw: DogJaw:
ValidTargets: Infantry ValidTargets: Infantry
ReloadDelay: 10 ReloadDelay: 10