Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chronoshift Trait Fixes #21340

Open
wants to merge 2 commits into
base: bleed
Choose a base branch
from

Conversation

atlimit8
Copy link
Member

This corrects ChronoshiftPower to support multiple Chronoshiftables (rather than crash by calling Actor.Trait<Chronoshiftable>()) as well as separating the return-to-origin timer by making Chronoshiftable a PausableConditionalTrait with PauseOnCondition controlling the timer. The indicator bar will not show until the timer has started running. Having RequiresCondition control both eligible Chronoshiftable for ChronoshiftPower and the return-to-origin timer can cause conflict when the actor is not supposed to be chronoshiftable but should automatically return to origin.

Example Test:

This test requires being within 25 cells to try teleporting and within 12 cells to not explode; the teleportation range also pauses the return-to-origin timer. This patch also includes a testing SOURCE for --update-mod. Running --update-mod in this patch will create extra PauseOnCondition since that is a new field for Chronoshiftable.

Apply the follwing patch which is also committed to https://github.com/atlimit8/OpenRA/tree/fix-multiple-Chronoshiftables-testing:

diff --git a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs
index 4c5d139da7..3ad438407f 100644
--- a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs
+++ b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs
@@ -92,6 +92,11 @@ public sealed class UpdatePath
 				new ReplaceCloakPalette(),
 				new AbstractDocking(),
 			}),
+
+			new("testing", new UpdateRule[]
+			{
+				new ChronoshiftableSplitPausable(),
+			}),
 		};
 
 		public static IReadOnlyCollection<UpdateRule> FromSource(ObjectCreator objectCreator, string source, bool chain = true)
diff --git a/mods/ra/maps/bomber-john/rules.yaml b/mods/ra/maps/bomber-john/rules.yaml
index a4c0f6942f..3d03b96dda 100644
--- a/mods/ra/maps/bomber-john/rules.yaml
+++ b/mods/ra/maps/bomber-john/rules.yaml
@@ -147,7 +147,7 @@ MNLYR:
 		Amount: 20
 	RenderSprites:
 		Image: MNLY
-	Chronoshiftable:
+	Chronoshiftable@SAFE_CHRONOSHIFTABLE:
 		ReturnToOrigin: false
 	HitShape:
 
diff --git a/mods/ra/maps/mousetrap/rules.yaml b/mods/ra/maps/mousetrap/rules.yaml
index d9ecca38e2..1a2a8f0a32 100644
--- a/mods/ra/maps/mousetrap/rules.yaml
+++ b/mods/ra/maps/mousetrap/rules.yaml
@@ -26,7 +26,9 @@ World:
 
 # Used in ChronoEffect.
 1TNK:
-	Chronoshiftable:
+	Chronoshiftable@CHRONOSHIFTABLE:
+		ChronoshiftSound:
+	Chronoshiftable@SAFE_CHRONOSHIFTABLE:
 		ChronoshiftSound:
 
 ^Soldier:
diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml
index 6236a13865..f0cbfa3eb0 100644
--- a/mods/ra/rules/defaults.yaml
+++ b/mods/ra/rules/defaults.yaml
@@ -262,7 +262,16 @@
 		ValidDamageStates: Light, Medium, Heavy, Critical
 	Repairable:
 		RepairActors: fix
-	Chronoshiftable:
+	Chronoshiftable@CHRONOSHIFTABLE:
+		RequiresCondition: chronoshiftable && !safe-chronoshiftable
+		ExplodeInstead: true
+	Chronoshiftable@SAFE_CHRONOSHIFTABLE:
+		RequiresCondition: safe-chronoshiftable
+		PauseOnCondition: chronoshiftable
+	ExternalCondition@CHRONOSHIFTABLE:
+		Condition: chronoshiftable
+	ExternalCondition@SAFE_CHRONOSHIFTABLE:
+		Condition: safe-chronoshiftable
 	Passenger:
 		CargoType: Vehicle
 	AttackMove:
@@ -525,7 +534,16 @@
 		TextNotification: notification-naval-unit-lost
 	ProximityCaptor:
 		Types: Ship
-	Chronoshiftable:
+	Chronoshiftable@CHRONOSHIFTABLE:
+		RequiresCondition: chronoshiftable && !safe-chronoshiftable
+		ExplodeInstead: true
+	Chronoshiftable@SAFE_CHRONOSHIFTABLE:
+		RequiresCondition: safe-chronoshiftable
+		PauseOnCondition: chronoshiftable
+	ExternalCondition@CHRONOSHIFTABLE:
+		Condition: chronoshiftable
+	ExternalCondition@SAFE_CHRONOSHIFTABLE:
+		Condition: safe-chronoshiftable
 	RepairableNear:
 		RepairActors: spen, syrd
 	GpsDot:
@@ -1075,7 +1093,16 @@
 	Targetable:
 		TargetTypes: GroundActor, Husk, NoAutoTarget
 		RequiresForceFire: true
-	Chronoshiftable:
+	Chronoshiftable@CHRONOSHIFTABLE:
+		RequiresCondition: chronoshiftable && !safe-chronoshiftable
+		ExplodeInstead: true
+	Chronoshiftable@SAFE_CHRONOSHIFTABLE:
+		RequiresCondition: safe-chronoshiftable
+		PauseOnCondition: chronoshiftable
+	ExternalCondition@CHRONOSHIFTABLE:
+		Condition: chronoshiftable
+	ExternalCondition@SAFE_CHRONOSHIFTABLE:
+		Condition: safe-chronoshiftable
 	Tooltip:
 		GenericName: meta-husk-generic-name
 
diff --git a/mods/ra/rules/ships.yaml b/mods/ra/rules/ships.yaml
index 5d61740ca9..43279d70cd 100644
--- a/mods/ra/rules/ships.yaml
+++ b/mods/ra/rules/ships.yaml
@@ -252,7 +252,10 @@ LST:
 		MaxWeight: 5
 		PassengerFacing: 0
 		LoadingCondition: notmobile
-	-Chronoshiftable:
+	-Chronoshiftable@CHRONOSHIFTABLE:
+	-Chronoshiftable@SAFE_CHRONOSHIFTABLE:
+	-ExternalCondition@CHRONOSHIFTABLE:
+	-ExternalCondition@SAFE_CHRONOSHIFTABLE:
 	Selectable:
 		DecorationBounds: 1536, 1536
 
diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml
index cab716e8ab..eb6265df61 100644
--- a/mods/ra/rules/structures.yaml
+++ b/mods/ra/rules/structures.yaml
@@ -547,6 +547,22 @@ PDOX:
 		SupportPowerPaletteOrder: 30
 		Dimensions: 5, 5
 		Footprint: __x__ _xxx_ xxxxx _xxx_ __x__
+	ProximityExternalCondition@CHRONOSHIFTABLE:
+		RequiresCondition: !disabled
+		Condition: chronoshiftable
+		Range: 25c0
+	WithRangeCircle@CHRONOSHIFTABLE:
+		Range: 25c0
+		Type: cloakgenerator
+		Color: FF510080
+	ProximityExternalCondition@SAFE_CHRONOSHIFTABLE:
+		RequiresCondition: !disabled
+		Condition: safe-chronoshiftable
+		Range: 12c0
+	WithRangeCircle@SAFE_CHRONOSHIFTABLE:
+		Range: 12c0
+		Type: safe-cloakgenerator
+		Color: 40FF0080
 	SupportPowerChargeBar:
 	InfiltrateForSupportPowerReset:
 		Types: SpyInfiltrate
diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml
index 800b3ee334..69212737f4 100644
--- a/mods/ra/rules/vehicles.yaml
+++ b/mods/ra/rules/vehicles.yaml
@@ -782,7 +782,7 @@ DTRK:
 	-DamageMultiplier@IRONCURTAIN:
 	KillsSelf:
 		RequiresCondition: invulnerability || triggered
-	Chronoshiftable:
+	Chronoshiftable@SAFE_CHRONOSHIFTABLE:
 		ExplodeInstead: true
 
 CTNK:
@@ -852,8 +852,8 @@ QTNK:
 		RequiresCondition: !deployed
 		PauseOnCondition: being-captured
 		Speed: 46
-	Chronoshiftable:
-		RequiresCondition: !deployed && !being-captured
+	Chronoshiftable@SAFE_CHRONOSHIFTABLE:
+		RequiresCondition: !deployed && !being-captured && safe-chronoshiftable
 	RevealsShroud:
 		MinRange: 4c0
 		Range: 6c0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant