Skip to content

Commit

Permalink
Code simplify on hover unit
Browse files Browse the repository at this point in the history
  • Loading branch information
dnqbob committed Jan 8, 2024
1 parent 020ab1a commit 784bfc2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 61 deletions.
36 changes: 34 additions & 2 deletions mods/sp/rules/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2055,6 +2055,38 @@
ActorStatValues:
Stats: Armor, Sight, Speed, Damage, ReloadDelay, MaxRange

^HoverDroneSoldier:
Inherits: ^DroneSoldier
Mobile:
Locomotor: HoverInfantry
KillsSelf@DisabledOnWater:
RequiresCondition: hoverunitonwater && (WebDisable || empdisable)
GrantConditionOnTerrain:
Condition: hoverunitonwater
TerrainTypes: Water
LeavesTrails:
RequiresCondition: hoverunitonwater
Image: wake
Palette: effect
TerrainTypes: Water
StationaryInterval: 18
MovingInterval: 12
Sequences: idle2
ExplodesAlsoTransported:
Weapon: DroneExplode
RequiresCondition: (!ascargo && !hoverunitonwater) || (!empdisable && !WebDisable)
ExplodesAlsoTransported@DisabledOnWater:
RequiresCondition: hoverunitonwater && (WebDisable || empdisable)
Weapon: UnitDrownedSmall
SpawnActorOnDeath@conversion:
RequiresCondition: !hoverunitonwater
SpawnActorOnDeath@conversionUpg:
RequiresCondition: !hoverunitonwater
-DamagedByTintedCells@Default:
-DamagedByTintedCells@BlueRadiation:
-DamagedByTintedCells@OrangeRadiation:
-DamagedByTintedCells@Colossus:

^CivilianInfantry:
Inherits: ^Infantry
Voiced:
Expand Down Expand Up @@ -2358,13 +2390,13 @@
SpawnAtLastPosition: false
TrailWhileStationary: true
StartDelay: -1
KillsSelf@hoverunitonwater:
RequiresCondition: hoverunitonwater && empdisable
GrantConditionOnTerrain:
Condition: hoverunitonwater
TerrainTypes: Water
ExplodesAlsoTransported:
RequiresCondition: !hoverunitonwater || !empdisable
KillsSelf@DisabledOnWater:
RequiresCondition: hoverunitonwater && empdisable
ExplodesAlsoTransported@DisabledOnWater:
RequiresCondition: hoverunitonwater && empdisable
Weapon: UnitDrowned
Expand Down
64 changes: 6 additions & 58 deletions mods/sp/rules/infantry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,7 @@ FLOAT:
AutoTarget:
ScanRadius: 7 #PREF: save trait looks up and scan armaments
-TakeCover:
KillsSelf@hoverunitonwater:
KillsSelf@DisabledOnWater:
RequiresCondition: hoverunitonwater && WebDisable
GrantConditionOnTerrain:
Condition: hoverunitonwater
Expand Down Expand Up @@ -2274,7 +2274,7 @@ SWARMLING:
-WithDeathAnimation@blood1:

PDRONE:
Inherits: ^DroneSoldier
Inherits: ^HoverDroneSoldier
Inherits@AUTOTARGET: ^AutoTargetGroundAssaultMove
Inherits@EXPERIENCE: ^GainsExperience
Inherits@RECYCLE: ^AffectedByReclaimAndRecycle
Expand Down Expand Up @@ -2344,31 +2344,8 @@ PDRONE:
FireDeath: 1, 2
ExplosionDeath: 1,2
EnergyDeath: 1,2
KillsSelf@hoverunitonwater:
RequiresCondition: hoverunitonwater && (WebDisable || empdisable)
GrantConditionOnTerrain:
Condition: hoverunitonwater
TerrainTypes: Water
LeavesTrails:
RequiresCondition: hoverunitonwater
Image: wake
Palette: effect
TerrainTypes: Water
StationaryInterval: 18
MovingInterval: 12
Sequences: idle2
ExplodesAlsoTransported:
Weapon: SimpleDroneExplode
RequiresCondition: (!ascargo && !hoverunitonwater) || (!empdisable && !WebDisable)
ExplodesAlsoTransported@DisabledOnWater:
RequiresCondition: hoverunitonwater && (WebDisable || empdisable)
Weapon: UnitDrownedSmall
-SpawnActorOnDeath@conversion:
-SpawnActorOnDeath@conversionUpg:
-DamagedByTintedCells@Default:
-DamagedByTintedCells@BlueRadiation:
-DamagedByTintedCells@OrangeRadiation:
-DamagedByTintedCells@Colossus:
ActorStatValues:
Damage: 63
Upgrades: upgrade.reclaim_and_recycle, upgrade.regenerative_materials
Expand Down Expand Up @@ -2437,7 +2414,8 @@ GLAD:
Upgrades: upgrade.cybernetic_leg_enhancements, upgrade.regenerative_materials

MOTH:
Inherits: ^DroneSoldier
Inherits: ^HoverDroneSoldier
Inherits@TINTEDCELLS: ^DamagedByTintedCells
Inherits@AUTOTARGET: ^AutoTargetGroundAssaultMove
Inherits@EXPERIENCE: ^GainsExperience
Inherits@REGENMATERIALS: ^AffectedByRegenerativeMaterials
Expand Down Expand Up @@ -2466,30 +2444,11 @@ MOTH:
RequiresCondition: !deployed && !WebDisable && !empdisable
Mobile:
Speed: 105
Locomotor: HoverInfantry
ImmovableCondition: !undeployed
PauseOnCondition: WebDisable || empdisable
RequireForceMoveCondition: !AImicroManage && !undeployed
Passenger:
RequireForceMoveCondition: !undeployed
LeavesTrails:
RequiresCondition: hoverunitonwater
Image: wake
Palette: effect
TerrainTypes: Water
StationaryInterval: 18
MovingInterval: 12
Sequences: idle2
KillsSelf@hoverunitonwater:
RequiresCondition: hoverunitonwater && (WebDisable || empdisable)
GrantConditionOnTerrain:
Condition: hoverunitonwater
TerrainTypes: Water
ExplodesAlsoTransported:
RequiresCondition: (!ascargo && !hoverunitonwater) || (!empdisable && !WebDisable)
ExplodesAlsoTransported@DisabledOnWater:
RequiresCondition: hoverunitonwater && (WebDisable || empdisable)
Weapon: UnitDrownedSmall
Health:
HP: 40000
Selectable:
Expand Down Expand Up @@ -2546,7 +2505,7 @@ MOTH:
Weapon: GLurkerProj
PauseOnCondition: WebDisable || empdisable
Armament@AIAimOnly:
RequiresCondition: AImicroManage && !deployed
RequiresCondition: AImicroManage && !deployed && !hoverunitonwater
Weapon: LurkerAimDummyWeapon
Name: AIAim
PauseOnCondition: WebDisable || empdisable
Expand Down Expand Up @@ -2824,7 +2783,7 @@ WORKERMECH:
Damage: 11

NANOS:
Inherits: ^DroneSoldier
Inherits: ^HoverDroneSoldier
Inherits@AUTOTARGET: ^AutoTargetGroundAssaultMove
Valued:
Cost: 100
Expand All @@ -2834,8 +2793,6 @@ NANOS:
HP: 7000
Mobile:
Speed: 60
Locomotor: HoverInfantry
PauseOnCondition: WebDisable
Hovers:
Voiced:
VoiceSet: Limpet
Expand Down Expand Up @@ -2865,17 +2822,8 @@ NANOS:
WithSpriteBody:
Sequence: idle
RequiresCondition: !inside-tunnel && !WebDisable
KillsSelf@hoverunitonwater:
RequiresCondition: hoverunitonwater && (WebDisable || empdisable)
GrantConditionOnTerrain:
Condition: hoverunitonwater
TerrainTypes: Water
ExplodesAlsoTransported:
Weapon: NanoDroneExplode
RequiresCondition: (!ascargo && !hoverunitonwater) || (!empdisable && !WebDisable)
ExplodesAlsoTransported@DisabledOnWater:
RequiresCondition: hoverunitonwater && (WebDisable || empdisable)
Weapon: UnitDrownedSmall
-SpawnCorpseOnDeath@nanomachinereanimate:
-SpawnActorOnDeath@conversion:
-SpawnActorOnDeath@conversionUpg:
Expand Down
3 changes: 2 additions & 1 deletion mods/sp/rules/vehicles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2475,6 +2475,7 @@ HVRTRUK3:
ExplodesForMaster:
Weapon: BombTruckExplo
EmptyWeapon: BombTruckExplo
RequiresCondition: !hoverunitonwater || !empdisable
## Only Enabled when as cargo
ExplodesAlsoTransported:
RequiresCondition: carried
Expand Down Expand Up @@ -3061,7 +3062,7 @@ LIMPED:
RequiresCondition: limpetaa
### AI Control: make limped drone wander randomly and deploy when find enemy
Armament@AIAimOnly:
RequiresCondition: AImicroManage && !deployed
RequiresCondition: AImicroManage && !deployed && !hoverunitonwater
Weapon: LimpedAimDummyWeapon
PauseOnCondition: empdisable
Name: AIAim
Expand Down

0 comments on commit 784bfc2

Please sign in to comment.