Skip to content

Commit

Permalink
Add customizable duration for electric bolts
Browse files Browse the repository at this point in the history
  • Loading branch information
Starkku committed Feb 25, 2025
1 parent 622f690 commit 20efc64
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
36 changes: 13 additions & 23 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1631,50 +1631,40 @@ In `rulesmd.ini`:
FireOnce.ResetSequence=true ; boolean
```

### Single-color lasers

![image](_static/images/issinglecolor.gif)
*Comparison of `IsSingleColor=yes` lasers with higher thickness to regular ones ([RA2: Reboot](https://www.moddb.com/mods/reboot))*

- You can now set laser to draw using only `LaserInnerColor` by setting `IsSingleColor`, in same manner as `IsHouseColor` lasers do using player's team color. These lasers respect laser thickness. Note that this is not available on prism support weapons.

In `rulesmd.ini`:
```ini
[SOMEWEAPON] ; WeaponType
IsSingleColor=false ; boolean
```

### Toggle-able ElectricBolt visuals
### Electric bolt customizations

![image](_static/images/ebolt.gif)
*EBolt customization utilized for different Tesla bolt weapon usage ([RA2: Reboot](https://www.moddb.com/mods/reboot))*

- You can now specify individual bolts you want to disable for `IsElectricBolt=true` weapons. Note that this is only a visual change.
- By default `IsElectricBolt=true` effect draws a bolt with 8 arcs. This can now be customized per WeaponType with `Bolt.Arcs`. Value of 0 results in a straight line being drawn.
- `Bolt.Duration` can be specified to explicitly set the overall duration of the visual electric bolt effect. Only values in range of 1 to 31 are accepted, values outside this range are clamped into it.

In `rulesmd.ini`:
```ini
[SOMEWEAPON] ; WeaponType
Bolt.Disable1=false ; boolean
Bolt.Disable2=false ; boolean
Bolt.Disable3=false ; boolean
Bolt.Arcs=8 ; integer
Bolt.Duration=17 ; integer, game frames
```

```{note}
Due to technical constraints, this does not work with electric bolts created from support weapon of [Ares' Prism Forwarding](https://ares-developers.github.io/Ares-docs/new/buildings/prismforwarding.html).
Due to technical constraints, these features do not work with electric bolts created from support weapon of [Ares' Prism Forwarding](https://ares-developers.github.io/Ares-docs/new/buildings/prismforwarding.html).
```

### Customizable ElectricBolt Arcs
### Single-color lasers

- By default `IsElectricBolt=true` effect draws a bolt with 8 arcs. This can now be customized per WeaponType with `Bolt.Arcs`. Value of 0 results in a straight line being drawn.
![image](_static/images/issinglecolor.gif)
*Comparison of `IsSingleColor=yes` lasers with higher thickness to regular ones ([RA2: Reboot](https://www.moddb.com/mods/reboot))*

- You can now set laser to draw using only `LaserInnerColor` by setting `IsSingleColor`, in same manner as `IsHouseColor` lasers do using player's team color. These lasers respect laser thickness. Note that this is not available on prism support weapons.

In `rulesmd.ini`:
```ini
[SOMEWEAPON] ; WeaponType
Bolt.Arcs=8 ; integer, number of arcs in a bolt
```

```{note}
Due to technical constraints, this does not work with electric bolts created from support weapon of [Ares' Prism Forwarding](https://ares-developers.github.io/Ares-docs/new/buildings/prismforwarding.html).
[SOMEWEAPON] ; WeaponType
IsSingleColor=false ; boolean
```

## RadialIndicator visibility
Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ New:
- Bunkerable checks dehardcode (by TaranDahl)
- No turret unit turn to the target (by CrimRecya & TaranDahl)
- Damage multiplier for different houses (by CrimRecya)
- Customizable duration for electric bolts (by Starkku)
Vanilla fixes:
- Prevent the units with locomotors that cause problems from entering the tank bunker (by TaranDahl)
Expand Down
3 changes: 2 additions & 1 deletion src/Ext/WeaponType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void WeaponTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->Bolt_Disable1.Read(exINI, pSection, "Bolt.Disable1");
this->Bolt_Disable2.Read(exINI, pSection, "Bolt.Disable2");
this->Bolt_Disable3.Read(exINI, pSection, "Bolt.Disable3");

this->Bolt_Arcs.Read(exINI, pSection, "Bolt.Arcs");
this->Bolt_Duration.Read(exINI, pSection, "Bolt.Duration");

this->RadType.Read<true>(exINI, pSection, "RadType");

Expand Down Expand Up @@ -127,6 +127,7 @@ void WeaponTypeExt::ExtData::Serialize(T& Stm)
.Process(this->Bolt_Disable2)
.Process(this->Bolt_Disable3)
.Process(this->Bolt_Arcs)
.Process(this->Bolt_Duration)
.Process(this->Strafing)
.Process(this->Strafing_Shots)
.Process(this->Strafing_SimulateBurst)
Expand Down
2 changes: 2 additions & 0 deletions src/Ext/WeaponType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class WeaponTypeExt
Valueable<bool> Bolt_Disable2;
Valueable<bool> Bolt_Disable3;
Valueable<int> Bolt_Arcs;
Valueable<int> Bolt_Duration;
Nullable<bool> Strafing;
Nullable<int> Strafing_Shots;
Valueable<bool> Strafing_SimulateBurst;
Expand Down Expand Up @@ -69,6 +70,7 @@ class WeaponTypeExt
, Bolt_Disable2 { false }
, Bolt_Disable3 { false }
, Bolt_Arcs { 8 }
, Bolt_Duration { 17 }
, Strafing { }
, Strafing_Shots {}
, Strafing_SimulateBurst { false }
Expand Down
6 changes: 5 additions & 1 deletion src/Ext/WeaponType/Hook.EBolt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ DEFINE_HOOK(0x6FD494, TechnoClass_FireEBolt_SetExtMap_AfterAres, 0x7)
GET(EBolt*, pBolt, EAX);

if (pWeapon)
BoltTemp::boltWeaponTypeExt[pBolt] = WeaponTypeExt::ExtMap.Find(pWeapon);
{
auto const pWeaponExt = WeaponTypeExt::ExtMap.Find(pWeapon);
BoltTemp::boltWeaponTypeExt[pBolt] = pWeaponExt;
pBolt->Lifetime = 1 << (Math::clamp(pWeaponExt->Bolt_Duration, 1, 31) - 1);
}

return 0;
}
Expand Down

0 comments on commit 20efc64

Please sign in to comment.