Skip to content

Conversation

@Coronia
Copy link
Owner

@Coronia Coronia commented Apr 16, 2025

  • A series of tags can force specified weapons based on the target's type.
    • If ForceWeapon.Defenses is enabled, it'll be used if the target is a building with IsBaseDefense=yes. Otherwise it'll follow ForceWeapon.Buildings, if enabled.
    • ForceWeapon.Infantry/Units/Aircraft can be applied to both ground and air target if ForceAAWeapon.Infantry/Units/Aircraft is not set.
    • ForceAAWeapon.Infantry/Units/Aircraft do the same things but only for air target. Taking priority to ForceWeapon.Infantry/Units/Aircraft, which means that they can only be applied to ground target when they're both set.

In rulesmd.ini:

[SOMETECHNO]                                    ; TechnoType
ForceWeapon.Buildings=-1                        ; integer, -1 to disable
ForceWeapon.Defenses=-1                         ; integer, -1 to disable
ForceWeapon.Infantry=-1                         ; integer, -1 to disable
ForceWeapon.Units=-1                            ; integer, -1 to disable
ForceWeapon.Aircraft=-1                         ; integer, -1 to disable
ForceAAWeapon.Infantry=-1                       ; integer, -1 to disable
ForceAAWeapon.Units=-1                          ; integer, -1 to disable
ForceAAWeapon.Aircraft=-1                       ; integer, -1 to disable

@github-actions
Copy link

github-actions bot commented Apr 16, 2025

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.

@Coronia Coronia force-pushed the force-weapon-by-type branch from 610296a to 4027758 Compare June 13, 2025 07:16
…type

# Conflicts:
#	CREDITS.md
#	docs/New-or-Enhanced-Logics.md
#	src/Ext/Techno/Body.h
#	src/Ext/Techno/Hooks.Firing.cpp
#	src/Ext/Techno/WeaponHelpers.cpp
#	src/Ext/TechnoType/Body.cpp
@Coronia Coronia force-pushed the force-weapon-by-type branch from 4027758 to 5b4225b Compare June 13, 2025 07:25
Coronia and others added 20 commits June 16, 2025 17:27
…hobos-developers#1725)

- `ExpireWeapon.UseInvokerAsOwner` can be used to set the house and
TechnoType that created the effect (e.g firer of the weapon that applied
it) as the weapon's owner & invoker instead of the object the effect is
attached to.
- `RevengeWeapon.UseInvokerAsOwner` can be used to set the house and
TechnoType that created the effect (e.g firer of the weapon that applied
it) as the weapon's owner & invoker instead of the object the effect is
attached to.
- `ReflectDamage.UseInvokerAsOwner` can be used to set the house and
TechnoType that created the effect (e.g firer of the weapon that applied
it) as the reflected damage's owner & invoker instead of the object the
effect is attached to.

In `rulesmd.ini`:
```ini
[SOMEATTACHEFFECT]                                 ; AttachEffectType
ExpireWeapon.UseInvokerAsOwner=false               ; boolean
RevengeWeapon.UseInvokerAsOwner=false              ; boolean
ReflectDamage.UseInvokerAsOwner=false              ; boolean
```
…evelopers#1723)

### Allows refineries to use multiple ActiveAnim simultaneously

- In vanilla, the refinery uses different ActiveAnims depending on the
storage. You can now make it use multiple ActiveAnims simultaneously
like any other building.

In `artmd.ini`:
```ini
[SOMEBUILDING]                         ; BuildingType
Refinery.UseNormalActiveAnim=false     ; boolean
```
- replace it with Type variable for Aircraft, Building, Infantry and Unit classes
- replace Find(techno->GetTechnoType()) with Find(techno)->TypeExtData
…os-developers#1728)

previous `Damage.DealtByInvoker` doesn't really apply to anim warhead,
this PR makes it inline with anim weapon. Notice that this might change
the behavior of anim weapon and warhead a bit, but I think this should
be the correct way. Any other feedbacks and reviews are welcome

`Damage.ApplyFirepowerMult` determines whether or not firepower
modifiers from the animation's invoker are applied on the damage dealt
from this animation, if exists
…hobos-developers#1729)

In vanilla game, aircraft will always return to airport even it still
has remain ammo and planning after target has been destroyed.
For now, the aircraft will continue attack next planning target if it
still has ammo.
- Fix `Spawner.LimitRange`
- Fix `IronCurtainColor`, `ForceShieldColor` and `BerserkColor`
- Remove unnecessary `pINI->GetSection(pSection)` judgments and their
hooks.

---------

Co-authored-by: NetsuNegi39 <negi542554365@outlook.com>
Co-authored-by: Coronia <2217891145@qq.com>
- LaserTrail can now drawn as other behaviour like EBolt or RadBeam.
- 激光轨迹现在可以绘制成电弧或辐射波的样式。
- You can also specific laser trail on attacheffect, the trail will
disappear if attacheffect is expired.
- 你也可以在AE上指定激光轨迹,这种激光轨迹将会在AE过期后消失。


[SOMETRAIL]                      ; LaserTrailType name
DrawType=laser                 ; enumeration (laser | ebolt | radbeam)
IsAlternateColor=false      ; boolean
Bolt.Color1=                      ; r, g, b
Bolt.Disable1=false           ; boolean
Bolt.Color2=                      ; r, g, b
Bolt.Disable2=false           ; boolean
Bolt.Color3=                      ; r, g, b
Bolt.Disable3=false           ; boolean
Beam.Color=                     ; r, g, b
Beam.Amplitude=40.0      ; double
FadeDuration= ; integer, default 64 for laser, 17 for electric, 15 for
radbeam

[SOMEATTACHEFFECT]
LaserTrail.Type=                                ; lasertrail type

---------

Co-authored-by: CrimRecya <335958461@qq.com>
Co-authored-by: Coronia <2217891145@qq.com>
split from Phobos-developers#1568. This
one is a bit controversial so I'd pull this alone for test and review
- instead of selecting weapon for every bullet, used the fixed value
from `Interceptor.Weapon` once and for all
- added a RearmTimer check for the interceptor process
- Now, the original `DebrisMaximums` can be used in conjunction with new
`DebrisMinimums` to limit the quantity of `DebrisTypes` when
`DebrisTypes.Limit` is enabled.
- The default value of `DebrisTypes.Limit` is whether the number of
`DebrisMaximums` is greater than (not equal to) 1 (for compatibility
reasons).

In `rulesmd.ini`:
```ini
[SOMETECHNO]        ; TechnoType
DebrisTypes.Limit=  ; boolean
DebrisMaximums=     ; List of integers
DebrisMinimums=     ; List of integers

[SOMEWARHEAD]       ; WarheadType
DebrisTypes.Limit=  ; boolean
DebrisMaximums=     ; List of integers
DebrisMinimums=     ; List of integers
```

```{hint}
How to generate `DebrisTypes` in the game:
- Generate the total number of debris through `MaxDebris` and `MinDebris` first.
- Traverse `DebrisTypes` and limit the quantity range through `DebrisMaximums` and `DebrisMinimums`.
- When the number of generated debris will exceeds the total number, limit the quantity and end the traversal.
- When the number of debris generated after a single traversal is not enough to exceed the total number, it will end if `DebrisTypes.Limit` is enabled, otherwise the traversal will restart like vanilla game do.
```
### Attack move - behavior when target acquired

- Now you can make attacking moving units stop moving when they spot an
enemy using `AttackMove.StopWhenTargetAcquired`. This is more like the
attack move behavior in starcraft and warcraft.
- This function is used to prevent units from charging forward and
taking on more damage.
- You can also make them move towards the spotted target using
`AttackMove.PursuitTarget`.
  - This function is used for close range units like ZEP.


In `rulesmd.ini`:
```ini
[General]
AttackMove.StopWhenTargetAcquired=         ; boolean

[SOMETECHNO]                               ; TechnoType
AttackMove.StopWhenTargetAcquired=         ; boolean, default to [General] -> AttackMove.StopWhenTargetAcquired if set, inverse of OpportunityFire otherwise.
AttackMove.PursuitTarget=                  ; boolean
```

```{note}
1. Many units would have stopped when they found an enemy. This behavior is independent of `AttackMove.StopWhenTargetAcquired`.
2. Some units (f.ex. jumpjets) will not fire correctly under the vanilla attack move. The exact reason is not clear, but this feature can fix this problem.
3. Jumpjets with `AttackMove.StopWhenTargetAcquired=true` will stop immediatly and not scatter to a cell. This is designed for practical reason.
```

### Attack move - follow

- Now you can have some units follow surrounding units when executing an
attack move. The following behavior is equivalent to the behavior when
using `ctrl + alt`.
- Use `AttackMove.Follow.IncludeAir` to determine whether the follower
will choose an air unit as a follow target.
- This function should be useful for auxiliary units such as medics and
repair drones.
- We have made additional optimizations to the followed target selection
algorithm to make this function more practical.

In `rulesmd.ini`:
```ini
[SOMETECHNO]                               ; TechnoType
AttackMove.Follow=false                    ; boolean
AttackMove.Follow.IncludeAir=false         ; boolean
```

### Attack move - without weapon

- In vanilla, a unit without weapon is not allowed to attack move. Now
you can disable this hardcoded behavior using
`AttackMove.IgnoreWeaponCheck=true`.
- Unarmed units of course cannot actually execute attack moves. This
feature is to prevent the attack move pointer from being disabled when
you select unarmed units and other units at the same time.

In `rulesmd.ini`:
```ini
[General]
AttackMove.IgnoreWeaponCheck=false    ; boolean
```

---------

Co-authored-by: Coronia <2217891145@qq.com>
Co-authored-by: CrimRecya <335958461@qq.com>
- `Grounded` has been abandoned, you can now use `GroundShape` to
specific a image which always draw on ground, it will only draw when
techno is in air if set `Ground.AlwaysDraw=false`, this also affect on
`GroundLine`.
- `Grounded` 已经被废弃了,你现在可以通过 `GroundShape` 指定一个始终绘制在地面的图像,若
`Ground.AlwaysDraw=false` ,那么它只会在单位位于空中时绘制,这也影响 `GroundLine` 的绘制。
- If `GroundLine=true` , the game will draw a line from techno's
position to its vertical projection, `GroundLine.Dashed=true` means the
projection line is a dashed line.
- 若 `GroundLine=true` ,那么游戏将会绘制一条从单位的位置到其垂直投影的线,`GroundLine.Dashed=true`
意味着投影线为虚线。

In `rulesmd.ini`:
```ini
[SOMESELECTBOXTYPE] ; Select box Type name
GroundShape=                            ; filename with .shp extension
GroundPalette=palette.pal               ; filename with .pal extension
GroundFrames=                           ; List of integer, default 1,1,1 for infantry, 0,0,0 for vehicle and aircraft
GroundOffset=0,0                        ; integers - horizontal, vertical
Ground.AlwaysDraw=true             ; boolean
GroundLine=false                        ; boolean
GroundLineColor=0,255,0                 ; R, G, B
GroundLineColor.ConditionYellow=        ; R, G, B
GroundLineColor.ConditionRed=           ; R, G, B
GroundLine.Dashed=false                 ; boolean
```
![W@`N 6J
G9@UM4MURW`LFIF](https://github.com/user-attachments/assets/d446947f-4afc-444d-91ee-b4ed35d7d387)

---------

Co-authored-by: CrimRecya <335958461@qq.com>
![multiweapons](https://github.com/user-attachments/assets/192f8aa9-baa2-4f9d-89c5-25f480f9d83e)
You are free to decide whether to use Weapon x or not, instead of
passively using Primary/secondary.
您可以自由决定是否启动WeaponX,而不是只能使用主/副武器。

- TechnoType reads `WeaponX` as their weapon when `MultiWeapon=yes`, be
careful not to forget `WeaponCount`.
`MultiWeapon=yes`时会读取`WeaponX`作为他们的武器,注意不要忘记了`WeaponCount`。

- `MultiWeapon.IsSecondary` can only be used by infantry, who will play
the animation `SecondaryFire` when using these weapons.
`MultiWeapon.IsSecondary`只能用于步兵,使用这些武器时步兵会播放`SecondaryFire`。

- `MultiWeapon.SelectCount` determines the number of weapons that can be
selected. The lower the number the better the performance. The default
is 2.
`MultiWeapon.SelectCount`决定可选择的武器数量。数量越少性能越好。默认为 2。

In `rulesmd.ini`:
```ini
[SOMETECHNO]                    ; TechnoType
MultiWeapon=                    ; boolean
MultiWeapon.IsSecondary=        ; List of integers
MultiWeapon.SelectCount=       ; integer
```
@Coronia Coronia force-pushed the force-weapon-by-type branch from 3960bfd to 7a543a0 Compare June 25, 2025 07:14
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.

8 participants