Skip to content

Factories canReclaim = false - #8159

Merged
Ruwetuin merged 1 commit into
beyond-all-reason:masterfrom
SethDGamre:factories_canreclaim=false
Jul 3, 2026
Merged

Factories canReclaim = false#8159
Ruwetuin merged 1 commit into
beyond-all-reason:masterfrom
SethDGamre:factories_canreclaim=false

Conversation

@SethDGamre

Copy link
Copy Markdown
Collaborator

Since they're builders and canReclaim is undefined, it seems the engine considers them as able to reclaim things. This is impossible for them to actually do as factories. This messes up the WIP FireState Defend I'm working on. #8139

Merge this with it.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Integration Test Results

14 tests  ±0   6 ✅ ±0   3s ⏱️ ±0s
 1 suites ±0   8 💤 ±0 
 1 files   ±0   0 ❌ ±0 

Results for commit fdbc631. ± Comparison against base commit ebae990.

@efrec

efrec commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

The factory doesn't do the reclaiming, but the builders it produces will. So you can just exclude factories in the defensive stance code if you need to.

@sprunk

sprunk commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

This is a bit of bad engine design where "can the unit actually perform this task" is lumped together with "can the unit receive an order about this task" despite them being at least technically independent.

@SethDGamre

Copy link
Copy Markdown
Collaborator Author

The factory doesn't do the reclaiming, but the builders it produces will. So you can just exclude factories in the defensive stance code if you need to.

This pr is the right approach. The factory cannot in fact reclaim anything. Describe reality.

@sprunk

sprunk commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Nah, prescribe reality

@Ruwetuin
Ruwetuin merged commit 2e84f2b into beyond-all-reason:master Jul 3, 2026
3 checks passed
@efrec

efrec commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

The factory doesn't do the reclaiming, but the builders it produces will. So you can just exclude factories in the defensive stance code if you need to.

This pr is the right approach. The factory cannot in fact reclaim anything. Describe reality.

Here's a bunch more stuff they can do:

https://github.com/beyond-all-reason/RecoilEngine/blob/092cb0a04ef4db8230bf781fbdc2a01d74a0c6a3/rts/Sim/Units/UnitDef.cpp#L380-L408

Ruwetuin pushed a commit that referenced this pull request Jul 4, 2026
Enable in ModOptions Experimental tab "New Defend Firestate" to use
Is greatly aided by merging:
#8159 as well
to prevent falsely considering factories as threats.

Replace the mostly unused Return Fire with a new and more useful
Defensive firestate. A defensive unit will shoot targets that are a
threat to itself on a 1v1 basis.

What's a threat?

If the target run up and shoot you before you can kill it, it's a
threat. This is done with prebaked math related to DPS, Distance,
movement speed, and health.

What's this useful for?
1. I don't want to shoot unarmed units. Useful during raids to take down
defenders.
2. I don't want to waste shots on trash until I really, really have to.
Useful for starlights, banishers, etc.

Random notes.
- units with >2000 range, Starburst Missiles, or are aircraft will shoot
anything at max range regardless of threat. Because they can't hit
moving things anyway or it's not relevant.
- constructors that can reclaim are considered threats same as if they
had a weapon
- cloaked defensive units will not shoot until they're no longer
cloaked.
- kamikaze targets will always be shot
- units with multiple weapons are biased to shoot things at farther
distances just to be safe (more precision would be less performant in a
stinky way)
- to prevent taking hits from radar things over and over with no
reaction, defensive units that take damage will aggro against radar dots
regardless of source. Logic being, if there are things closeby they'll
prefer them anyway. If there are only radar dots to shoot, they'll
shoot. This resets upon changing
 firestate or after being healed. 
- under the hood, return fire is unchanged so ruins unaffected.
Defensive is a virtual firestate that uses fire at will with
AllowWeaponTarget filtering for its behavior.
 
I'm most active on discord, you can participate in the brunt of
discussion here:
https://discord.com/channels/549281623154229250/1520166826435280998/1520166826435280998

AI disclosure:
Used claude 4.8, gpt 5.5, and cursor's "auto mode" to conduct research,
suggest and write some of the changes, and change the unitdefs. The
shape of the functions, flow, and design and decisions for changes are
strictly mine.
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.

4 participants