-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add enter-cloak & exit-cloak effect for Cloak #19881
Conversation
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
@@ -167,16 +181,34 @@ void ITick.Tick(Actor self) | |||
cloakedToken = self.GrantCondition(Info.CloakedCondition); | |||
|
|||
// Sounds shouldn't play if the actor starts cloaked | |||
if (!(firstTick && Info.InitialDelay == 0) && !otherCloaks.Any(a => a.Cloaked)) | |||
if (!(firstTick && Info.InitialDelay == 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!(firstTick && Info.InitialDelay == 0)) | |
if (!firstTick || Info.InitialDelay > 0) |
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
@@ -63,6 +64,24 @@ public class CloakInfo : PausableConditionalTraitInfo | |||
[Desc("The condition to grant to self while cloaked.")] | |||
public readonly string CloakedCondition = null; | |||
|
|||
[Desc("Which image to use for effect when enter/exit cloak.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Desc("Which image to use for effect when enter/exit cloak.")] | |
[Desc("Which image to use for the effect played when cloaking or uncloaking.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
[Desc("Which image to use for effect when enter/exit cloak.")] | ||
public readonly string EffectImage = null; | ||
|
||
[Desc("Which sequence to use for effect when enter cloak.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Desc("Which sequence to use for effect when enter cloak.")] | |
[Desc("Which effect sequence to play when cloaking.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
|
||
[Desc("Which sequence to use for effect when enter cloak.")] | ||
[SequenceReference(nameof(EffectImage), allowNullImage: true)] | ||
public readonly string EnterEffectSequence = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public readonly string EnterEffectSequence = null; | |
public readonly string CloakEffectSequence = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
[SequenceReference(nameof(EffectImage), allowNullImage: true)] | ||
public readonly string EnterEffectSequence = null; | ||
|
||
[Desc("Which sequence to use for effect when exit cloak..")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Desc("Which sequence to use for effect when exit cloak..")] | |
[Desc("Which effect sequence to play when uncloaking.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
|
||
[Desc("Which sequence to use for effect when exit cloak..")] | ||
[SequenceReference(nameof(EffectImage), allowNullImage: true)] | ||
public readonly string ExitEffectSequence = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public readonly string ExitEffectSequence = null; | |
public readonly string UncloakEffectSequence = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
public readonly string EffectPalette = "effect"; | ||
public readonly bool IsEffectPlayerPalette = false; | ||
|
||
[Desc("Offset for effect when enter/exit cloak.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Desc("Offset for effect when enter/exit cloak.")] | |
[Desc("Offset for the effect played when cloaking or uncloaking.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
|
||
[PaletteReference(nameof(IsEffectPlayerPalette))] | ||
public readonly string EffectPalette = "effect"; | ||
public readonly bool IsEffectPlayerPalette = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public readonly bool IsEffectPlayerPalette = false; | |
public readonly bool EffectPaletteIsPlayerPalette = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this seems unused so please remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
third-party mod may need this on stealth effect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix the spelling, not removed
8cb6815
to
1e37cc2
Compare
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
palette += self.Owner.InternalName; | ||
|
||
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect( | ||
pos + Info.EffectOffset, w, Info.EffectImage, Info.CloakEffectSequence, palette))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pos + Info.EffectOffset, w, Info.EffectImage, Info.CloakEffectSequence, palette))); | |
pos + Info.EffectOffset, w, Info.EffectImage, Info.UncloakEffectSequence, palette))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:< fixed
mods/ts/rules/nod-vehicles.yaml
Outdated
PauseOnCondition: cloak-force-disabled || empdisable | ||
CloakedCondition: cloak-self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test what happens when you build a Stealth Tank within the radius of a Stealth Generator? I would expect it still plays the cloak sound with this setup. Thinking more about it we might need to restore the old checks, as I'm no longer sure this is doable using conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is still here. going restore the check but I will change it by getting the same cloak type on the unit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ummm, I meet a issue when get the same cloak type. In fact it is cloak types, like targetables. could we make the "InitialDelay = 0" of TS stealth tank's Cloak to avoid this?
Still the example: submarine is under the effect of Stealth Generator.
Submerge is a kind of cloak, Stealth is a kind of cloak. In regular logic, being stealth and make the sound of steath field doesn't(or may not) prevent submarine make sound of go under the water.
The use case here is more complicated: only one of the two stealth generators can work. In orignal TS, if what I remeber is correct, the Stealth Tank doesn't recieve the buff from Stealth Generator: when it get heavily damaged, Stealth Generator cannot cloak it like other heavily damage vehicle. If we want to use the gameplay setting like orignal TS it is also simple to solve.
In conclusion, we have 3 ideas here:
- make InitialDelay=0 for stealth tank cloak (I confirm it is working)
- change back to TS orignal setting: Stealth Generator doesn't affect Stealth Tank
- add Cloak something to identify the same cloak method, without using CloakTypes (or we use CloakTypes with a not so confusing rule), which may makes the code more confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the yaml it makes perfect sense why they cloak twice, so I think it should also be solved via yaml. IMO in this case hardcoding the solution only limits modders
I can see 2 easy ways of fixing this
- Stealth tank overwrites stealth generator stealth instead of being separate
- Stealth generator stealth is disabled on stealth tank
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And one feature creep way. Add a property on cloak called TriggerCloakOnConditions
. That way you could disable external cloak on stealth tank, but add the external condition to stank cloak. The TriggerCloakOnConditions
would ignore the internal cloak delay and cloak immediately when any of the set conditions become
true cloakgenerator, crate-cloak
. I'm not sure if we can set conditions this way though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the problem with using CloakTypes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the problem with using CloakTypes?
CloakTypes cannot be used as a standard that tell OpenRA some Cloak traits belong to one kind of cloak, which have the same cloak&uncloak sound/visual effect and have some special rule when playing the sound/visual effect. For example, Stealth Tank cloak and Cloak Generator cloak.
if we want to solve this problem perfectly, we need another property in CloakInfo like CloakClass/CloakKind or something, restore the check but this check is only effective on the same CloakClass/CloakKind.
To make it more readable I want to rename CloakTypes into DetectableTypes, and make another CloakType to differ the same cloak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make it more readable I want to rename CloakTypes into DetectableTypes, and make another CloakType to differ the same cloak.
That sounds like a good idea. I suggest DetectionTypes
(because they're used for detection, and the types themselves are not detectable).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it is done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untested but looks good now in theory. Can you add an update rule for the CloakTypes
-> DetectionTypes
changes?
I'd love to but I never did the same thing before so could you tell me how to use the rule system? |
1fab49e is an example for how to do an update rule: |
thanks, idk if now it is correct |
Change the Update: ummm acutally not |
Can you change it back? (Calling the |
it is back now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(You can remove the test cases from RA now; before we accidentally merge them. 😅)
Which one, both? |
Can this be expanded to grant a condition when cloaking and a condition when uncloaking? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One typo I spotted, not a proper review.
I second the request to remove the testcases, IMO the submarine splash in particular doesn't look good and may be confusing for players thinking that something is firing on it.
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
|
||
[GrantedConditionReference] | ||
[Desc("The condition to grant to self while cloaked.")] | ||
public readonly string CloakedCondition = null; | ||
|
||
[Desc("The type of cloak. Same type of cloaks won't tigger cloaking and uncloaking sound and effect.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tigger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about the other usecase of stealth apc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and dropped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, though I'm not 100% sure about the RA STNK sparkle effect
Not merging yet since I don't know how others feel about the STNK sparkle effect. |
Maybe not in this branch, but it is possible to make it grant a condition when cloaking and a condition when uncloaking |
The animation doesn't follow a moving actor, is this intended? |
There hasn't been great support for this change on Discord, so I'd prefer if we can fix the animation not following actors and then remove the effect from the Phase Transport. |
Yes, considering usecase of submarine (appear and disappear with a water splash) and ninja (disappear with a smoke screen), the cloak effect of those should not follow the actor, but play at the effect triggered position instead. However, now I make the user can set the follow or not.
Spark still not remove for you to test out and test the setting of follow/not follow function. Once it is done I will remove the testcase here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracking works. ✅
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
public readonly WVec EffectOffset = WVec.Zero; | ||
|
||
[Desc("Should the effect track the actor.")] | ||
public readonly bool EffectTrackActor = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public readonly bool EffectTrackActor = true; | |
public readonly bool EffectTracksActor = true; |
OpenRA.Mods.Common/Traits/Cloak.cs
Outdated
palette += self.Owner.InternalName; | ||
|
||
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect( | ||
posFunc: posfunc, facingFunc: () => WAngle.Zero, w, Info.EffectImage, Info.CloakEffectSequence, palette))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming the parameters should not be necessary, or is it?
posFunc: posfunc, facingFunc: () => WAngle.Zero, w, Info.EffectImage, Info.CloakEffectSequence, palette))); | |
posfunc, () => WAngle.Zero, w, Info.EffectImage, Info.CloakEffectSequence, palette))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be all fixed here and drop the test case
Still I hope there can be somewhere use the cloak effect, for maintaining unused code will be hard without an usecase |
close #19880