Skip to content
Open
60 changes: 43 additions & 17 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- They can also have map lighting apply on them if `AltPalette.ApplyLighting` is set to true.
- Fixed `DeployToFire` not considering building placement rules for `DeploysInto` buildings and as a result not working properly with `WaterBound` buildings.
- Fixed `DeployToFire` not recalculating firer's position on land if it cannot currently deploy.
- `Arcing=true` projectile elevation inaccuracy can now be fixed by setting `Arcing.AllowElevationInaccuracy=false`.
- `Arcing=true` projectile elevation inaccuracy can now be fixed by setting `Arcing.AllowElevationInaccuracy=false`, default to `[CombatDamage] -> Arcing.AllowElevationInaccuracy`.
- Wall overlays are now drawn with the custom palette defined in `Palette` in `artmd.ini` if possible.
- Setting `ReloadInTransport` to true on units with `Ammo` will allow the ammo to be reloaded according to `Reload` or `EmptyReload` timers even while the unit is inside a transport.
- Setting `ReloadInTransport` to true on units with `Ammo` will allow the ammo to be reloaded according to `Reload` or `EmptyReload` timers even while the unit is inside a transport. Can also be defined at `[General] -> ReloadInTransport` for a global default value.
- It is now possible to enable `Verses` and `PercentAtMax` to be applied on negative damage by setting `ApplyModifiersOnNegativeDamage` to true on the Warhead.
- Attached animations on flying units now have their layer updated immediately after the parent unit, if on same layer they always draw above the parent.
- Fixed an issue where the powered anims of `Powered` / `PoweredSpecial` buildings cease to update when being captured by enemies.
Expand Down Expand Up @@ -759,8 +759,11 @@ CurleyShuffle= ; boolean, default to [General] -> CurleyShuffle

In `rulesmd.ini`:
```ini
[SOMEAIRCRAFT] ; AircraftType
FiringForceScatter=true ; boolean
[General]
AircraftFiringForceScatter=true ; boolean

[SOMEAIRCRAFT] ; AircraftType
FiringForceScatter= ; boolean, default to [General] -> AircraftFiringForceScatter
```

### Extended Aircraft Missions
Expand Down Expand Up @@ -1382,13 +1385,16 @@ BallisticScatter.Max= ; floating point value, distance in cells
In `rulesmd.ini`:
```ini
[CombatDamage]
Shrapnel.IgnoreHitBuildings=false ; boolean

[SOMEPROJECTILE] ; Projectile
Shrapnel.AffectsGround=false ; boolean
Shrapnel.AffectsBuildings=false ; boolean
Shrapnel.UseWeaponTargeting=false ; boolean
Shrapnel.IgnoreHitBuildings= ; boolean
Shrapnel.IgnoreHitBuildings=false ; boolean

[SOMEPROJECTILE] ; Projectile
Shrapnel.AffectsGround= ; boolean, default to [CombatDamage] -> Shrapnel.AffectsGround
Shrapnel.AffectsBuildings= ; boolean, default to [CombatDamage] -> Shrapnel.AffectsBuildings
Shrapnel.UseWeaponTargeting= ; boolean, default to [CombatDamage] -> Shrapnel.UseWeaponTargeting
Shrapnel.IgnoreHitBuildings= ; boolean, default to [CombatDamage] -> Shrapnel.IgnoreHitBuildings
```

## Technos
Expand Down Expand Up @@ -1760,11 +1766,15 @@ DropPod.Weapon.HitLandOnly= ; boolean, default to no

In `rulesmd.ini`:
```ini
[SOMETECHNO] ; TechnoType
[General]
Explodes.KillPassengers=true ; boolean
Explodes.DuringBuildup=true ; boolean

[SOMETECHNO] ; TechnoType
Explodes.KillPassengers= ; boolean, default to [General] -> Explodes.KillPassengers

[SOMEBUILDING] ; BuildingType
Explodes.DuringBuildup=true ; boolean
Explodes.DuringBuildup= ; boolean, default to [General] -> Explodes.DuringBuildup
```

### Forbid parallel AI queues
Expand Down Expand Up @@ -2101,9 +2111,13 @@ MinimapColor= ; integer - Red,Green,Blue

In `rulesmd.ini`:
```ini
[SOMETERRAINTYPE] ; TerrainType
IsPassable=false ; boolean
CanBeBuiltOn=false ; boolean
[General]
Terrain.IsPassable=false ; boolean
Terrain.CanBeBuiltOn=false ; boolean

[SOMETERRAINTYPE] ; TerrainType
IsPassable= ; boolean, default to [General] -> Terrain.IsPassable
CanBeBuiltOn= ; boolean, default to [General] -> Terrain.CanBeBuiltOn
```

## Tiberiums (ores)
Expand Down Expand Up @@ -2359,10 +2373,15 @@ KeepTargetOnMove.ExtraDistance=0 ; floating point value, distance in cells

In `rulesmd.ini`:
```ini
[SOMEVEHICLE] ; VehicleType
[General]
Sinkable= ; boolean
SinkSpeed=5 ; integer, leptons per frame
Sinkable.SquidGrab=true ; boolean

[SOMEVEHICLE] ; VehicleType
Sinkable= ; boolean, default to [General] -> Sinkable
SinkSpeed=5 ; integer, leptons per frame, default to [General] -> SinkSpeed
Sinkable.SquidGrab=true ; boolean, default to [General] -> Sinkable.SquidGrab
```

### Stationary vehicles
Expand Down Expand Up @@ -2542,6 +2561,10 @@ Rocker.AmplitudeOverride= ; integer

In `rulesmd.ini`:
```ini
[General]
CreateAnimsOnZeroDamage=false ; boolean
Conventional.IgnoreUnits=false ; boolean

[SOMEWARHEAD] ; WarheadType
AnimList.PickRandom=false ; boolean
AnimList.CreateAll=false ; boolean
Expand All @@ -2554,8 +2577,8 @@ SplashList.CreateAll=false ; boolean
SplashList.CreationInterval=0 ; integer
SplashList.ScatterMin=0.0 ; floating point value, distance in cells
SplashList.ScatterMax=0.0 ; floating point value, distance in cells
CreateAnimsOnZeroDamage=false ; boolean
Conventional.IgnoreUnits=false ; boolean
CreateAnimsOnZeroDamage= ; boolean, default to [General] -> CreateAnimsOnZeroDamage
Conventional.IgnoreUnits=false ; boolean, default to [General] -> Conventional.IgnoreUnits
```

### Customizable Warhead trigger conditions
Expand All @@ -2581,8 +2604,11 @@ EffectsRequireVerses=false ; boolean

In `rulesmd.ini`:
```ini
[SOMEWARHEAD] ; WarheadType
[General]
DecloakDamagedTargets=true ; boolean

[SOMEWARHEAD] ; WarheadType
DecloakDamagedTargets= ; boolean, default to [General] -> DecloakDamagedTargets
```

### Customizing locomotor warhead
Expand Down
41 changes: 31 additions & 10 deletions docs/New-or-Enhanced-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ This page describes all the engine features that are either new and introduced b
- `ForceDecloak`, if set to true, will uncloak and make the object the effect is attached to unable to cloak itself for duration of the effect.
- `WeaponRange.Multiplier` and `WeaponRange.ExtraRange` can be used to multiply the weapon firing range of the object the effect is attached to, or give it an increase / decrease (measured in cells), respectively. `ExtraRange` is cumulatively applied from all attached effects after all `Multiplier` values have been applied.
- `WeaponRange.AllowWeapons` can be used to list only weapons that can benefit from this range bonus and `WeaponRange.DisallowWeapons` weapons that are not allowed to, respectively.
- On TechnoTypes with `OpenTopped=true`, `OpenTopped.UseTransportRangeModifiers` can be set to true to make passengers firing out use the transport's active range bonuses instead.
- On TechnoTypes with `OpenTopped=true`, `OpenTopped.UseTransportRangeModifiers` can be set to true to make passengers firing out use the transport's active range bonuses instead. `[General] -> OpenTopped.UseTransportRangeModifiers` defines its global default value.
- `Crit.Multiplier` and `Crit.ExtraChance` can be used to multiply the [critical hit](#chance-based-extra-damage-or-warhead-detonation--critical-hits) chance or grant a fixed bonus to it for the object the effect is attached to, respectively.
- `Crit.AllowWarheads` can be used to list only Warheads that can benefit from this critical hit chance multiplier and `Crit.DisallowWarheads` weapons that are not allowed to, respectively.
- `RevengeWeapon` can be used to temporarily grant the specified weapon as a [revenge weapon](#revenge-weapon) for the attached object.
Expand All @@ -56,7 +56,7 @@ This page describes all the engine features that are either new and introduced b
- Warheads can prevent reflect damage from occuring by setting `SuppressReflectDamage` to true. `SuppressReflectDamage.Types` can control which AttachEffectTypes' reflect damage is suppressed, if none are listed then all of them are suppressed. `SuppressReflectDamage.Groups` does the same thing but for all AttachEffectTypes in the listed groups.
- `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.
- `DisableWeapons` can be used to disable ability to fire any and all weapons.
- On TechnoTypes with `OpenTopped=true`, `OpenTopped.CheckTransportDisableWeapons` can be set to true to make passengers not be able to fire out if transport's weapons are disabled by `DisableWeapons`.
- On TechnoTypes with `OpenTopped=true`, `OpenTopped.CheckTransportDisableWeapons` can be set to true to make passengers not be able to fire out if transport's weapons are disabled by `DisableWeapons`. `[General] -> OpenTopped.CheckTransportDisableWeapons` defines its global default value.
- `Unkillable` can be used to prevent the techno from being killed by taken damage (minimum health will be 1).
- It is possible to set groups for attach effect types by defining strings in `Groups`.
- Groups can be used instead of types for removing effects and weapon filters.
Expand Down Expand Up @@ -152,14 +152,18 @@ Unkillable=false ; boolean
LaserTrail.Type= ; LaserTrailType
Groups= ; comma-separated list of strings (group IDs)

[General]
OpenTopped.UseTransportRangeModifiers=false ; boolean
OpenTopped.CheckTransportDisableWeapons=false ; boolean

[SOMETECHNO] ; TechnoType
AttachEffect.AttachTypes= ; List of AttachEffectTypes
AttachEffect.DurationOverrides= ; integer - duration overrides (comma-separated) for AttachTypes in order from first to last.
AttachEffect.Delays= ; integer - delays (comma-separated) for AttachTypes in order from first to last.
AttachEffect.InitialDelays= ; integer - initial delays (comma-separated) for AttachTypes in order from first to last.
AttachEffect.RecreationDelays= ; integer - recreation delays (comma-separated) for AttachTypes in order from first to last.
OpenTopped.UseTransportRangeModifiers=false ; boolean
OpenTopped.CheckTransportDisableWeapons=false ; boolean
OpenTopped.UseTransportRangeModifiers= ; boolean, default to [General] -> OpenTopped.UseTransportRangeModifiers
OpenTopped.CheckTransportDisableWeapons= ; boolean, default to [General] -> OpenTopped.CheckTransportDisableWeapons

[SOMEWEAPON] ; WeaponType
AttachEffect.RequiredTypes= ; List of AttachEffectTypes
Expand Down Expand Up @@ -822,6 +826,9 @@ BombParachute= ; AnimationType, default to [General] -> BombParachute

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

[SOMETECHNO] ; TechnoType
Interceptor=false ; boolean
Interceptor.Weapon=0 ; integer, weapon slot index (0 or 1)
Expand Down Expand Up @@ -1474,9 +1481,13 @@ PassengerDeletion.UnderEMP=false ; boolean

In `rulesmd.ini`:
```ini
[SOMETECHNO] ; TechnoType
[General]
Passengers.SyncOwner=false ; boolean
Passengers.SyncOwner.RevertOnExit=true ; boolean

[SOMETECHNO] ; TechnoType
Passengers.SyncOwner= ; boolean, default to [General] -> Passengers.SyncOwner
Passengers.SyncOwner.RevertOnExit= ; boolean, default to [General] -> Passengers.SyncOwner.RevertOnExit
```

### Automatically firing weapons
Expand Down Expand Up @@ -1588,22 +1599,29 @@ DrainMoneyDisplay.OnTarget.UseDisplayIncome= ; boolean
In `rulesmd.ini`:
```ini
[General]
OpenTopped.IgnoreRangefinding=false ; boolean
OpenTopped.AllowFiringIfDeactivated=true ; boolean
OpenTopped.ShareTransportTarget=true ; boolean
OpenTopped.AllowFiringIfAttackedByLocomotor=true ; boolean
OpenTopped.DecloakToFire=true ; boolean

[SOMETECHNO] ; TechnoType, transport with OpenTopped=yes
OpenTopped.RangeBonus= ; integer, default to [CombatDamage] -> OpenToppedRangeBonus
OpenTopped.DamageMultiplier= ; floating point value, default to [CombatDamage] -> OpenToppedDamageMultiplier
OpenTopped.WarpDistance= ; integer, default to [CombatDamage] -> OpenToppedWarpDistance
OpenTopped.IgnoreRangefinding=false ; boolean
OpenTopped.AllowFiringIfDeactivated=true ; boolean
OpenTopped.IgnoreRangefinding= ; boolean, defaults to [General] -> OpenTopped.IgnoreRangefinding
OpenTopped.AllowFiringIfDeactivated= ; boolean, defaults to [General] -> OpenTopped.AllowFiringIfDeactivated
OpenTopped.AllowFiringIfAttackedByLocomotor= ; boolean, defaults to [General] -> OpenTopped.AllowFiringIfAttackedByLocomotor
OpenTopped.ShareTransportTarget=true ; boolean
OpenTopped.ShareTransportTarget= ; boolean, defaults to [General] -> OpenTopped.ShareTransportTarget
OpenTopped.DecloakToFire= ; boolean, defaults to [General] -> OpenTopped.DecloakToFire

[SOMETECHNO] ; TechnoType, passenger
[CombatDamage]
OpenTransport.RangeBonus=0 ; integer
OpenTransport.DamageMultiplier=1.0 ; floating point value

[SOMETECHNO] ; TechnoType, passenger
OpenTransport.RangeBonus= ; integer, defaults to [CombatDamage] -> OpenTransport.RangeBonus
OpenTransport.DamageMultiplier= ; floating point value, defaults to [CombatDamage] -> OpenTransport.DamageMultiplier
```

```{note}
Expand Down Expand Up @@ -2327,8 +2345,11 @@ Ammo.DeployUnlockMaximumAmount=-1 ; integer

In `rulesmd.ini`:
```ini
[SOMEVEHICLE] ; VehicleType
[General]
HoverDrownable=true ; boolean

[SOMEVEHICLE] ; VehicleType
HoverDrownable= ; boolean, default to [General] -> HoverDrownable
```

### Damaged unit image changes
Expand Down
6 changes: 3 additions & 3 deletions src/Ext/Aircraft/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ DEFINE_HOOK(0x41879D, AircraftClass_Mission_Attack_StrafeCell, 0x6)

AircraftExt::FireWeapon(pThis, pTargetCell);

if (pExt->TypeExtData->FiringForceScatter)
if (pExt->TypeExtData->FiringForceScatter.Get(RulesExt::Global()->AircraftFiringForceScatter))
pTargetCell->ScatterContent(pThis->Location, true, false, false);

pThis->SetDestination(pTargetCell, true);
Expand All @@ -344,13 +344,13 @@ DEFINE_HOOK_AGAIN(0x418B46, AircraftClass_MissionAttack_ScatterCell1, 0x6)
DEFINE_HOOK(0x41847E, AircraftClass_MissionAttack_ScatterCell1, 0x6)
{
GET(AircraftClass*, pThis, ESI);
return TechnoTypeExt::ExtMap.Find(pThis->Type)->FiringForceScatter ? 0 : (R->Origin() + 0x44);
return TechnoTypeExt::ExtMap.Find(pThis->Type)->FiringForceScatter.Get(RulesExt::Global()->AircraftFiringForceScatter) ? 0 : (R->Origin() + 0x44);
}

DEFINE_HOOK(0x4186DD, AircraftClass_MissionAttack_ScatterCell2, 0x5)
{
GET(AircraftClass*, pThis, ESI);
return TechnoTypeExt::ExtMap.Find(pThis->Type)->FiringForceScatter ? 0 : (R->Origin() + 0x43);
return TechnoTypeExt::ExtMap.Find(pThis->Type)->FiringForceScatter.Get(RulesExt::Global()->AircraftFiringForceScatter) ? 0 : (R->Origin() + 0x43);
}

#pragma endregion
Expand Down
2 changes: 1 addition & 1 deletion src/Ext/Bullet/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void BulletExt::ExtData::InterceptBullet(TechnoClass* pSource, BulletClass* pInt
this->InitializeLaserTrails();

// Lose target if the current bullet is no longer interceptable.
if (pSource && (!pTypeExt->Interceptable || (pTypeExt->Armor.isset() && GeneralUtils::GetWarheadVersusArmor(pInterceptor->WH, pTypeExt->Armor.Get()) == 0.0)))
if (pSource && (!pTypeExt->Interceptable.Get(RulesExt::Global()->Interceptable) || (pTypeExt->Armor.isset() && GeneralUtils::GetWarheadVersusArmor(pInterceptor->WH, pTypeExt->Armor.Get()) == 0.0)))
pSource->SetTarget(nullptr);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ext/Bullet/Hooks.DetonateLogics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ DEFINE_HOOK(0x469B44, BulletClass_Logics_LandTypeCheck, 0x6)

auto const pWHExt = WarheadTypeExt::ExtMap.Find(pThis->WH);

if (pWHExt->Conventional_IgnoreUnits)
if (pWHExt->Conventional_IgnoreUnits.Get(RulesExt::Global()->Conventional_IgnoreUnits))
return SkipChecks;

return 0;
Expand Down
12 changes: 4 additions & 8 deletions src/Ext/Bullet/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,12 @@ DEFINE_HOOK(0x46A3D6, BulletClass_Shrapnel_Forced, 0xA)
{
return Shrapnel;
}
else if (pTypeExt->Shrapnel_AffectsBuildings)
else if (pTypeExt->Shrapnel_AffectsBuildings.Get(RulesExt::Global()->Shrapnel_AffectsBuildings))
{
ShrapnelTemp::InitialTargetBuilding = static_cast<BuildingClass*>(pObject);
return Shrapnel;
}
}
else if (pTypeExt->Shrapnel_AffectsGround)
{
return Shrapnel;
}

return Skip;
}
Expand Down Expand Up @@ -286,7 +282,7 @@ DEFINE_HOOK(0x46A4FB, BulletClass_Shrapnel_Targeting, 0x6)

auto const pOwner = pSource->Owner;

if (pTypeExt->Shrapnel_UseWeaponTargeting)
if (pTypeExt->Shrapnel_UseWeaponTargeting.Get(RulesExt::Global()->Shrapnel_UseWeaponTargeting))
{
auto const pWeaponExt = WeaponTypeExt::ExtMap.Find(pShrapnelWeapon);
auto const pType = pObject->GetType();
Expand Down Expand Up @@ -499,7 +495,7 @@ DEFINE_HOOK(0x6FF008, TechnoClass_Fire_BeforeMoveTo, 0x8)

const auto pBulletType = pBullet->Type;

if (pBulletType->Arcing && !BulletTypeExt::ExtMap.Find(pBulletType)->Arcing_AllowElevationInaccuracy)
if (pBulletType->Arcing && !BulletTypeExt::ExtMap.Find(pBulletType)->Arcing_AllowElevationInaccuracy.Get(RulesExt::Global()->Arcing_AllowElevationInaccuracy))
{
REF_STACK(BulletVelocity, velocity, STACK_OFFSET(0xB0, -0x60));
REF_STACK(const CoordStruct, crdSrc, STACK_OFFSET(0xB0, -0x6C));
Expand All @@ -519,7 +515,7 @@ DEFINE_HOOK(0x44D46E, BuildingClass_Mission_Missile_BeforeMoveTo, 0x8)

const auto pBulletType = pBullet->Type;

if (pBulletType->Arcing && !BulletTypeExt::ExtMap.Find(pBulletType)->Arcing_AllowElevationInaccuracy)
if (pBulletType->Arcing && !BulletTypeExt::ExtMap.Find(pBulletType)->Arcing_AllowElevationInaccuracy.Get(RulesExt::Global()->Arcing_AllowElevationInaccuracy))
{
REF_STACK(BulletVelocity, velocity, STACK_OFFSET(0xE8, -0xD0));
REF_STACK(const CoordStruct, crdSrc, STACK_OFFSET(0xE8, -0x8C));
Expand Down
Loading
Loading