Skip to content

Commit

Permalink
Fix the Battle Fortress can't carry infantries
Browse files Browse the repository at this point in the history
  • Loading branch information
cookgreen committed Mar 7, 2019
1 parent 2b316da commit e0e486f
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 12 deletions.
8 changes: 4 additions & 4 deletions OpenRA.Mods.YR/Activities/EnterBunker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ protected override void OnInside(Actor self)
w.Add(new SpriteEffect(bunker.CenterPosition, w, bunker.Info.Name, cargo.Info.SequenceOnCargo, "player" + self.Owner.InternalName));
}
if (cargo.GetBunkeredNumber() == 0)
{
cargo.GrantCondition(passenger.info.GrantBunkerCondition);
}
//if (cargo.GetBunkeredNumber() == 0)
//{
// cargo.GrantCondition(passenger.info.GrantBunkerCondition);
//}
cargo.Load(bunker, self);
if(willDisappear)
{
Expand Down
8 changes: 4 additions & 4 deletions OpenRA.Mods.YR/Activities/UnloadBunkerCargo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ public override Activity Tick(Actor self)

cargo.Unloading = true;

if (cargo.GetBunkeredNumber() == 0)
{
cargo.RevokeCondition();
}
//if (cargo.GetBunkeredNumber() == 0)
//{
// cargo.RevokeCondition();
//}

return this;
}
Expand Down
26 changes: 24 additions & 2 deletions OpenRA.Mods.YR/Traits/BunkerPassenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class BunkerPassengerInfo : ConditionalTraitInfo

[VoiceReference] public readonly string Voice = "Action";

[Desc("Whose actors can accept this actor?")]
public readonly string[] Accepter = null;

public override object Create(ActorInitializer init) { return new BunkerPassenger(init, this); }
}

Expand Down Expand Up @@ -79,6 +82,14 @@ public void GrantCondition()

public void RevokeCondition()
{
if (bunkeredCondToken == ConditionManager.InvalidConditionToken)
{
return;
}
if (!conditionManager.TokenValid(self, bunkeredCondToken))
{
return;
}
bunkeredCondToken = conditionManager.RevokeCondition(self, bunkeredCondToken);
}

Expand All @@ -98,11 +109,22 @@ public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool qu
bool IsCorrectCargoType(Actor target)
{
var ci = target.Info.TraitInfo<BunkerCargoInfo>();
var bk = self.TraitOrDefault<Bunkerable>();
if (bk == null)

bool canAccept = false;
//this actor are not welcomed by the target actor
for (int i = 0; i < info.Accepter.Length; i++)
{
if (info.Accepter[i] == target.Info.Name)
{
canAccept = true;
break;
}
}
if (!canAccept)
{
return false;
}

return ci.Types.Contains(Info.CargoType);
}

Expand Down
22 changes: 21 additions & 1 deletion mods/yr/rules/allied-infantry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ e1:
Prerequisites: barracks.infiltrated
QuantizeFacingsFromSequence:
Sequence: stand
Bunkerable:
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: nabnkr, bfrt

ggi:
Inherits@1: ^Infantry
Expand Down Expand Up @@ -302,6 +306,11 @@ ggi:
Prerequisites: barracks.infiltrated
QuantizeFacingsFromSequence:
Sequence: stand
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: nabnkr, bfrt

snipe:
Inherits: ^Infantry
Expand Down Expand Up @@ -344,6 +353,11 @@ snipe:
Prerequisites: barracks.infiltrated
WithInfantryBody:
DefaultAttackSequence: shoot
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: bfrt

spy:
Inherits: ^Infantry
Expand Down Expand Up @@ -396,6 +410,7 @@ spy:
Voice: Action
QuantizeFacingsFromSequence:
Sequence: stand
-BunkerPassenger:

ghost:
Inherits: ^Infantry
Expand Down Expand Up @@ -458,6 +473,11 @@ ghost:
WithInfantryBody:
DefaultAttackSequence: shoot
-TakeCover: # TODO: allow multiple sequence modifiers
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: bfrt

ccomand:
Inherits: ghost
Expand Down
10 changes: 10 additions & 0 deletions mods/yr/rules/allied-vehicles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,15 @@ bfrt:
EmptyWeapon: UnitExplodeSmall
RenderSprites:
RenderVoxels:
BunkerCargo:
Types: Infantry
MaxWeight: 5
PipCount: 5
AttackBunkered:
Armaments: primary
PortOffsets: 384,0,128, 224,-341,128, -224,-341,128, -384,0,128, -224,341,128, 224,341,128/*TODO: Need to confirm all five attack port*/
PortYaws: 0, 176, 341, 512, 682, 853
PortCones: 88, 88, 88, 88, 88, 88
WithVoxelBody:
Voiced:
VoiceSet: BattleFortressVoice
Expand All @@ -620,3 +629,4 @@ bfrt:
CrewKillable:
SelfHealing@MACHSHOP:
RequiresCondition: machshop
-BunkerPassenger:
11 changes: 11 additions & 0 deletions mods/yr/rules/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@
Condition: chaosgasability
Berserkable:
RequiresCondition: chaosgasability

^Diskdrainshutdownpowerable:
TimedConditionBar:
Condition: diskdrainability
ExternalCondition@DISKDRAINABILITY:
Condition: diskdrainability
ShutdownPower:
RequiresCondition: diskdrainability

^ChronoDisable:
TimedConditionBar@ChronoDisable:
Expand Down Expand Up @@ -648,6 +656,7 @@
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: nabnkr
HiddenUnderFog:
ActorLostNotification:
ProximityCaptor:
Expand Down Expand Up @@ -770,6 +779,7 @@
IdleSequences: idle1
EditorTilesetFilter:
Categories: Civilian infantry
-BunkerPassenger:

^Animal:
Inherits: ^Infantry
Expand Down Expand Up @@ -845,6 +855,7 @@
CargoType: Vehicle
Weight: 3
GrantBunkerCondition: bunkered
Accepter: natbnk
HiddenUnderFog:
WithTextControlGroupDecoration:
ActorLostNotification:
Expand Down
1 change: 1 addition & 0 deletions mods/yr/rules/misc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pcv.colorpicker:
RenderVoxels:
Image: pcv
Palette: colorpicker
-Buildable:

SROCK01:
Inherits: ^Rock
Expand Down
4 changes: 4 additions & 0 deletions mods/yr/rules/proxy-actors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ allies.tech.infiltrated:
soviets.tech.infiltrated:
AlwaysVisible:
ProvidesPrerequisite:

yuris.tech.infiltrated:
AlwaysVisible:
ProvidesPrerequisite:
27 changes: 27 additions & 0 deletions mods/yr/rules/soviet-infantry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ e2:
QuantizeFacingsFromSequence:
Sequence: stand
Bunkerable:
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: nabnkr, brft

flakt:
Inherits@1: ^Infantry
Expand Down Expand Up @@ -98,6 +103,11 @@ flakt:
Prerequisites: barracks.infiltrated
QuantizeFacingsFromSequence:
Sequence: stand
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: nabnkr, bfrt

shk:
Inherits@1: ^Infantry
Expand Down Expand Up @@ -163,6 +173,11 @@ shk:
QuantizeFacingsFromSequence:
Sequence: stand
-Crushable:
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: bfrt

terror:
Inherits: ^Infantry
Expand Down Expand Up @@ -206,6 +221,7 @@ terror:
-TakeCover:
QuantizeFacingsFromSequence:
Sequence: stand
-BunkerPassenger:

deso:
Inherits: ^Infantry
Expand Down Expand Up @@ -256,6 +272,11 @@ deso:
QuantizeFacingsFromSequence:
Sequence: stand
-Crushable:
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: bfrt

ivan:
Inherits: ^Infantry
Expand Down Expand Up @@ -310,6 +331,7 @@ ivan:
QuantizeFacingsFromSequence:
Sequence: stand
-Crushable:
-BunkerPassenger:

boris:
Inherits@1: ^Infantry
Expand Down Expand Up @@ -368,3 +390,8 @@ boris:
SpawnAllAtOnce: true
SpawnerArmamentName: secondary
-Crushable:
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: bfrt
29 changes: 28 additions & 1 deletion mods/yr/rules/yuri-infantry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ init:
WithInfantryBody
DefaultAttackSequence: shoot
Bunkerable:
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: nabnkr, bfrt

yengineer:
Inherits: ^Infantry
Expand Down Expand Up @@ -128,6 +133,7 @@ brute:
WithInfantryBody
DefaultAttackSequence: shoot
-Crushable:
-BunkerPassenger:

virus:
Inherits: ^Infantry
Expand Down Expand Up @@ -170,6 +176,11 @@ virus:
VoiceSet: VirusVoice
WithInfantryBody
DefaultAttackSequence: shoot
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: bfrt

slav:
Inherits: ^Infantry
Expand Down Expand Up @@ -214,6 +225,7 @@ slav:
OnMasterKilled: Free
OnMasterChangeOwner: Free
FreeCondition: freed
-BunkerPassenger:

yuri:
Inherits: ^Infantry
Expand Down Expand Up @@ -292,6 +304,11 @@ yuri:
AutoTargetPriority@DEFAULT:
Types: MindControl
RequiresCondition: !controlling
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: bfrt

yuripr:
Inherits: ^Infantry
Expand Down Expand Up @@ -372,6 +389,11 @@ yuripr:
Types: MindControl
RequiresCondition: !controlling
-Crushable:
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: bfrt

julia:
Inherits: ^Infantry
Expand Down Expand Up @@ -420,4 +442,9 @@ julia:
VoiceSet: VirusVoice
WithInfantryBody
DefaultAttackSequence: shoot
-Crushable:
-Crushable:
BunkerPassenger:
Voice: Move
CargoType: Infantry
GrantBunkerCondition: bunkered
Accepter: bfrt

0 comments on commit e0e486f

Please sign in to comment.