Skip to content

Conversation

@TaranDahl
Copy link
Contributor

Passive acquire mode

  • Now you can order the units to enter "Ceasefire Mode" or "Aggressive Mode", just like in RA3.
    • In ceasefire mode, units will only attack the targets specified by the player.
    • In aggressive mode, units will automatically attack all enemies, including buildings without weapons.
    • In normal mode, units will auto-target like usual.
  • You can use two hotkeys to switch between these two modes if [General] -> EnablePassiveAcquireMode is set to true. When you press one of these hotkeys:
    • If all selected units are in that mode, they will switch to the normal mode. Otherwise, they will enter that mode. Units that cannot switch modes are not counted.
    • If any unit successfully switches its mode, a sound effect will be emitted. This sound can be customized through [TechnoType] -> Voice(Enter/Exit)(Aggressive/Ceasefire)Mode.
  • You can use [TechnoType] -> PassiveAcquireMode.Togglable to specify whether the unit can toggle its mode.
  • You can use [TechnoType] -> PassiveAcquireMode to specify the unit's initial mode.

In rulesmd.ini:

[General]
EnablePassiveAcquireMode=false        ; boolean

[SOMETECHNO]                          ; TechnoType
PassiveAcquireMode=Normal             ; passive acquire mode, Normal / Aggressive / Ceasefire
PassiveAcquireMode.Togglable=true     ; boolean
VoiceEnterAggressiveMode=             ; Sound entry, default to VoiceAttack or VoiceMove
VoiceExitAggressiveMode=              ; Sound entry, default to VoiceMove or VoiceSelect
VoiceEnterCeasefireMode=              ; Sound entry, default to VoiceSelect or VoiceMove
VoiceExitCeasefireMode=               ; Sound entry, default to VoiceAttack or VoiceMove

[ ] Ceasefire Mode

  • Order the selected units to enter or exit the ceasefire mode. See this for details.
  • For localization add TXT_CEASEFIRE_MODE, TXT_CEASEFIRE_MODE_DESC, MSG:CEASEFIRE_MODE_ON and MSG:CEASEFIRE_MODE_OFF into your .csf file.

[ ] Aggressive Mode

  • Order the selected units to enter or exit the aggressive mode. See this for details.
  • For localization add TXT_AGGRESSIVE_MODE, TXT_AGGRESSIVE_MODE_DESC, MSG:AGGRESSIVE_MODE_ON and MSG:AGGRESSIVE_MODE_OFF into your .csf file.

@TaranDahl TaranDahl added ❓New feature ⚙️T2 T2 maintainer review is sufficient labels Sep 10, 2025
@github-actions
Copy link

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Metadorius
Copy link
Member

Previously when discussing stances we figured there should be a button/indicator at bottom bar. Have this went anywhere? If I recall correctly, someone even had the code to add custom buttons there.

@TaranDahl
Copy link
Contributor Author

Previously when discussing stances we figured there should be a button/indicator at bottom bar. Have this went anywhere? If I recall correctly, someone even had the code to add custom buttons there.

Hmmmm ... where is that code then🤔

@FS-21
Copy link
Contributor

FS-21 commented Sep 10, 2025

Aggressive stance if I'm not wrong :-/

@TaranDahl
Copy link
Contributor Author

Aggressive stance if I'm not wrong :-/

#1464 did not touch the bottom bar.

@Coronia
Copy link
Contributor

Coronia commented Sep 10, 2025

Could there be visual indicator on techno to tell which of them is in aggressive/passive stance if it’s toggleable?

@TaranDahl
Copy link
Contributor Author

Maybe it could be drawn next to the unit like the insignia.
But I don't think this is a good idea. We already have too many things to draw next to the unit.
I'm asking Crim to open a pr for his bottom bar.

@Metadorius
Copy link
Member

Maybe it could be drawn next to the unit like the insignia. But I don't think this is a good idea. We already have too many things to draw next to the unit. I'm asking Crim to open a pr for his bottom bar.

I think @Otamaa had the code for custom vanilla bottom bar buttons?

@CrimRecya
Copy link
Contributor

@Otamaa
Copy link
Contributor

Otamaa commented Sep 18, 2025

Maybe it could be drawn next to the unit like the insignia. But I don't think this is a good idea. We already have too many things to draw next to the unit. I'm asking Crim to open a pr for his bottom bar.

I think @Otamaa had the code for custom vanilla bottom bar buttons?

my code is more big than Crim one , i do play around with these for a bit just for fun :
https://github.com/Otamaa/Phobos-Minimal/blob/f2ac3f68b7561d3b91b1d59d13ac9f6a601cb573/src/Misc/Hook.CommandButtons.cpp

@TaranDahl
Copy link
Contributor Author

Previously when discussing stances we figured there should be a button/indicator at bottom bar. Have this went anywhere? If I recall correctly, someone even had the code to add custom buttons there.

@Metadorius The existing code has exceeded 500 lines. I think it's better to complete this PR before initiating a new one to finish these tasks, to avoid overwhelming the reviewer with too much code. What do you think?

@Metadorius
Copy link
Member

Metadorius commented Oct 30, 2025

@Metadorius The existing code has exceeded 500 lines. I think it's better to complete this PR before initiating a new one to finish these tasks, to avoid overwhelming the reviewer with too much code. What do you think?

@TaranDahl I propose to take CrimRecya's implementation of the bottom bar buttons from #1453 separately as a new PR without any extra logics (maybe could do a new button for triggering Select Next Idle Harvester command; however, I am not sure if the buttons have to be always tied to CommandClass, this is up for discussion), reviewing/refactoring it so it fits our standards, merging, and then rebasing this PR so it can use it.

oh and don't merge latest develop commit, we're deciding how to proceed on it

@Metadorius
Copy link
Member

resolved the situation with develop, feel free to merge it

Copy link
Contributor

@CrimRecya CrimRecya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some minor issues, but overall it looks good. I think the bottom bar part can be added after merging, of course, it depends on what you think.

Comment on lines +17 to +22
#include <CCINIClass.h>
#include <InputManagerClass.h>
#include <MouseClass.h>
#include <WWMouseClass.h>

#include <Utilities/Macro.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't need these for the time being.

isAllSelectedUnitAggressiveMode = false;
TechnoVectorNonAggressive.push_back(pTechno);
}
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line of return is a bit redundant.

isAllSelectedUnitCeasefireMode = false;
TechnoVectorNonCeasefire.push_back(pTechno);
}
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@@ -1,4 +1,4 @@
#include "Body.h"
#include "Body.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may have accidentally modified the encoding format of the file.

@@ -1,4 +1,4 @@
#pragma once
#pragma once
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@@ -1,4 +1,4 @@
#pragma once
#pragma once
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Comment on lines +395 to +401
DEFINE_HOOK(0x6F8E1F, TechnoClass_SelectAutoTarget_CeasefireMode, 0x6)
{
GET(TechnoTypeClass*, pType, EAX);
GET(TechnoClass*, pThis, ESI);
R->CL(pType->NoAutoFire || (TechnoExt::ExtMap.Find(pThis)->GetPassiveAcquireMode()) == PassiveAcquireMode::Ceasefire);
return R->Origin() + 0x6;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this hook will make AI to ignore the ceasefire mode?

Comment on lines +1 to +6
#pragma once
#include <InfantryClass.h>
#include <AnimClass.h>

#include <Ext/TechnoType/Body.h>
#include <Ext/BuildingType/Body.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, prioritize including these dependencies in separate files instead of including them in header files.

Comment on lines +821 to +825
auto previousMode = this->PassiveAquireMode;
this->PassiveAquireMode = newMode;

if (newMode == previousMode)
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto previousMode = this->PassiveAquireMode;
this->PassiveAquireMode = newMode;
if (newMode == previousMode)
return;
const auto previousMode = this->PassiveAquireMode;
if (newMode == previousMode)
return;
this->PassiveAquireMode = newMode;


const auto pThis = this->OwnerObject();
const auto pTechnoType = this->TypeExtData->OwnerObject();
int voiceIndex;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it's just a suggestion. I just don't like having an uninitialized variable. You can try encapsulating the following code into a static inline or lambda function called process... and returning a voice index.

@TaranDahl
Copy link
Contributor Author

@TaranDahl I propose to take CrimRecya's implementation of the bottom bar buttons from #1453 separately as a new PR without any extra logics (maybe could do a new button for triggering Select Next Idle Harvester command; however, I am not sure if the buttons have to be always tied to CommandClass, this is up for discussion), reviewing/refactoring it so it fits our standards, merging, and then rebasing this PR so it can use it.

@CrimRecya How about this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants