Maintain a family of units with inheritance
Reduce duplication while keeping variant differences readable
Choose a genuinely shared base
Both switchfire vehicles share controls, memory and ammunition, mode.ini is a playable base unit while guard.ini overrides the heavier variant
# 使用相同操作逻辑,只改基础数值 / Reuse the controls with different stats
[core]
copyFrom: mode.ini
name: rwa02ModeGuard
displayText: 变弹护卫车 / Switchfire Guard
price: 650
maxHp: 460
[graphics]
image: guard.png
[movement]
moveSpeed: 0.7
Trace the effective value
If shot counting fails for both vehicles, inspect the base turret event and counter action, if only the guard speed is wrong, inspect its movement override
Reuse repeated sections too
File inheritance suits unit variants, section templates suit repeated turrets within a file, share values such as delay and still provide each turret position and projectile
[template_weapon]
delay: 1.2s
[turret_left]
@copyFromSection: template_weapon
x: -7
y: 0
projectile: shell
[turret_right]
@copyFromSection: template_weapon
x: 7
y: 0
projectile: shellKeep the inheritance chain understandable
Prefer one base and one variant layer for small projects, test every dependent unit after changing shared code and update copyFrom when moving or renaming files
Try it yourself
Add a third switchfire vehicle overriding only cost, health, speed and art