starting manual trimming pass, switching to solid lasers, custom weapon and beam lua

This commit is contained in:
cardboardbread committed 2026-10-16 18:08:47 -04:00
1 parent 57dc6bb8c3
commit 70f34f8f40
151 files changed
+1643 -1479

No files matched your search

+96 -91
View File
@@ -18,14 +18,14 @@
"speed_mult = 3\n",
"\n",
"ballistic_velocity = 30\n",
"energy_velocity = 60\n",
"pulse_velocity = 120\n",
"missile_velocity = 15\n"
"energy_velocity = 100\n",
"pulse_velocity = 100\n",
"missile_velocity = 25\n"
]
},
{
"cell_type": "code",
"execution_count": 45,
"execution_count": 214,
"id": "48125b87",
"metadata": {},
"outputs": [
@@ -201,7 +201,7 @@
" 'units\\\\WDBANDITCP\\\\WDBANDITCP_unit.bp']"
]
},
"execution_count": 45,
"execution_count": 214,
"metadata": {},
"output_type": "execute_result"
}
@@ -215,7 +215,7 @@
},
{
"cell_type": "code",
"execution_count": 46,
"execution_count": 215,
"id": "7974de88",
"metadata": {},
"outputs": [
@@ -225,7 +225,7 @@
"{'Destroyed': 125,\n",
" 'DoneBeingBuilt': 49,\n",
" 'UISelection': 167,\n",
" 'Fire': 409,\n",
" 'Fire': 407,\n",
" 'Construct': 27,\n",
" 'ConstructLoop': 27,\n",
" 'DeathExplosion': 34,\n",
@@ -257,7 +257,7 @@
" 'MuzzleChargeStart': 1}"
]
},
"execution_count": 46,
"execution_count": 215,
"metadata": {},
"output_type": "execute_result"
}
@@ -286,12 +286,13 @@
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": 216,
"id": "f75cfb51",
"metadata": {},
"outputs": [],
"source": [
"# Sanity check\n",
"# Setup and sanity check\n",
"blueprints = []\n",
"\n",
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
@@ -299,21 +300,23 @@
" assert 'BTSource' in blueprint\n",
" assert 'BattleValue' in blueprint['BTSource']\n",
" assert 'Tonnage' in blueprint['BTSource']\n",
" assert 'HitPoints' in blueprint['BTSource']"
" assert 'HitPoints' in blueprint['BTSource']\n",
"\n",
" blueprints.append(blueprint)\n",
"\n",
"assert len(blueprints) == len(files)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 217,
"id": "23145ae9",
"metadata": {},
"outputs": [],
"source": [
"# Compute defense\n",
"\n",
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
"\n",
"for blueprint in blueprints:\n",
" assert 'Defense' in blueprint\n",
" \n",
" battle_value = blueprint['BTSource']['BattleValue']\n",
@@ -370,23 +373,19 @@
"\n",
" # health\n",
" blueprint['Defense']['Health'] = hit_points * damage_mult\n",
" blueprint['Defense']['MaxHealth'] = hit_points * damage_mult\n",
"\n",
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
" blueprint['Defense']['MaxHealth'] = hit_points * damage_mult"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 218,
"id": "d69eb968",
"metadata": {},
"outputs": [],
"source": [
"# Compute economy\n",
"\n",
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
"\n",
"for blueprint in blueprints:\n",
" assert 'Economy' in blueprint\n",
"\n",
" battle_value = blueprint['BTSource']['BattleValue']\n",
@@ -417,9 +416,7 @@
" if battle_value != 0 and 'StorageEnergy' in blueprint['Economy']:\n",
" blueprint['Economy']['StorageEnergy'] = battle_value * 5\n",
" if battle_value != 0 and 'StorageMass' in blueprint['Economy']:\n",
" blueprint['Economy']['StorageMass'] = battle_value / 2\n",
"\n",
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
" blueprint['Economy']['StorageMass'] = battle_value / 2"
]
},
{
@@ -429,50 +426,61 @@
"metadata": {},
"outputs": [],
"source": [
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
" \n",
"for blueprint in blueprints:\n",
" if 'Weapon' in blueprint:\n",
" for weapon in blueprint['Weapon']:\n",
"\n",
" racks = len(weapon['RackBones'])\n",
" weapon['RateOfFire'] = racks / 10\n",
" weapon['TargetCheckInterval'] = (racks / 10) * 2\n",
" weapon['RackReloadTimeout'] = 10\n",
"\n",
" salvo_size = weapon['MuzzleSalvoSize']\n",
" if salvo_size > 1:\n",
" weapon['MuzzleSalvoDelay'] = 1 / salvo_size\n",
" else:\n",
" weapon['MuzzleSalvoDelay'] = 0\n",
" if 'RackBones' in weapon:\n",
" racks = len(weapon['RackBones'])\n",
" weapon['RateOfFire'] = racks / 10\n",
" weapon['TargetCheckInterval'] = (racks / 10) * 2\n",
"\n",
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
" salvo_size = weapon['MuzzleSalvoSize']\n",
" if salvo_size > 1:\n",
" weapon['MuzzleSalvoDelay'] = 1 / salvo_size * racks\n",
" else:\n",
" weapon['MuzzleSalvoDelay'] = 0\n",
"\n",
" # thing = len(weapon['RackBones'][0]['MuzzleBones'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 220,
"id": "23747809",
"metadata": {},
"outputs": [],
"source": [
"# Standardize weapon targets\n",
"\n",
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
" \n",
"for blueprint in blueprints:\n",
" if 'Weapon' in blueprint:\n",
" for weapon in blueprint['Weapon']:\n",
"\n",
" # weapon['AboveWaterFireOnly']\n",
" # weapon['AboveWaterTargetsOnly']\n",
"\n",
" if 'Intel' in blueprint and 'RadarRadius' in blueprint['Intel']:\n",
" # weapon['TrackingRadius'] = blueprint['Intel']['RadarRadius']\n",
" if 'TrackingRadius' in weapon:\n",
" weapon.pop('TrackingRadius')\n",
" elif 'Intel' in blueprint and 'VisionRadius' in blueprint['Intel']:\n",
" # weapon['TrackingRadius'] = blueprint['Intel']['VisionRadius']\n",
" if 'TrackingRadius' in weapon:\n",
" weapon.pop('TrackingRadius')\n",
"\n",
" if 'WeaponCategory' in weapon and weapon['WeaponCategory'] == 'Death':\n",
" continue\n",
"\n",
" weapon['FireTargetLayerCapsTable'] = {} # clear existing\n",
"\n",
" if 'AIR' in blueprint['Categories'] or 'HIGHALTAIR' in blueprint['Categories']:\n",
" weapon['FireTargetLayerCapsTable']['Air'] = 'Air|Land|Water'\n",
" weapon['FireTargetLayerCapsTable']['Land'] = 'Air|Land|Water'\n",
"\n",
" if 'LAND' in blueprint['Categories']:\n",
" if 'LAND' in blueprint['Categories'] or 'STRUCTURE' in blueprint['Categories']:\n",
" weapon['FireTargetLayerCapsTable']['Land'] = 'Air|Land|Water'\n",
" \n",
" if 'MECH' in blueprint['Categories']:\n",
@@ -480,7 +488,7 @@
" weapon['FireTargetLayerCapsTable']['Water'] = 'Air|Land|Water|Sub|Seabed'\n",
" weapon['FireTargetLayerCapsTable']['Seabed'] = 'Water|Sub|Seabed'\n",
"\n",
" if 'HOVER' in blueprint['Categories']:\n",
" if 'HOVER' in blueprint['Categories'] or blueprint['Physics']['BuildOnLayerCaps']['LAYER_Water'] == True:\n",
" weapon['FireTargetLayerCapsTable']['Land'] = 'Air|Land|Water'\n",
" weapon['FireTargetLayerCapsTable']['Water'] = 'Air|Land|Water'\n",
"\n",
@@ -493,19 +501,12 @@
" weapon['FireTargetLayerCapsTable']['Seabed'] = 'Water|Sub|Seabed'\n",
"\n",
" weapon['TargetRestrictDisallow'] = 'UNTARGETABLE'\n",
" # weapon['UseFiringSolutionInsteadOfAimBone'] = true\n",
"\n",
" if 'Intel' in blueprint and 'RadarRadius' in blueprint['Intel']:\n",
" weapon['TrackingRadius'] = blueprint['Intel']['RadarRadius']\n",
" elif 'Intel' in blueprint and 'VisionRadius' in blueprint['Intel']:\n",
" weapon['TrackingRadius'] = blueprint['Intel']['VisionRadius']\n",
"\n",
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
" # weapon['UseFiringSolutionInsteadOfAimBone'] = true"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 221,
"id": "c2ce647b",
"metadata": {},
"outputs": [],
@@ -581,29 +582,24 @@
" 'ALLUNITS',\n",
"]\n",
"\n",
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
" \n",
"for blueprint in blueprints:\n",
" if 'Weapon' in blueprint:\n",
" for weapon in blueprint['Weapon']:\n",
" if blueprint['WeaponCategory'] == 'Bomb':\n",
" weapon['TargetPriorities'] = bomber\n",
"\n",
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
" if 'WeaponCategory' in weapon:\n",
" if weapon['WeaponCategory'] == 'Bomb':\n",
" weapon['TargetPriorities'] = bomber"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 222,
"id": "8075055d",
"metadata": {},
"outputs": [],
"source": [
"# Standardize weapon stats\n",
"\n",
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
" \n",
"for blueprint in blueprints: \n",
" if 'Weapon' in blueprint:\n",
" for weapon in blueprint['Weapon']:\n",
" if weapon['DisplayName'] == 'Particle Projector Cannon':\n",
@@ -851,23 +847,19 @@
" weapon['WeaponCategory'] = 'Defense'\n",
" weapon['RangeCategory'] = 'UWRC_Countermeasure'\n",
" weapon['TargetType'] = 'RULEWTT_Projectile'\n",
" weapon['TargetRestrictOnlyAllow'] = 'TACTICAL MISSILE'\n",
"\n",
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
" weapon['TargetRestrictOnlyAllow'] = 'TACTICAL MISSILE'"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 223,
"id": "56a7499a",
"metadata": {},
"outputs": [],
"source": [
"# Standardize autocannon weapon stats\n",
"\n",
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
" \n",
"for blueprint in blueprints: \n",
" if 'Weapon' in blueprint:\n",
" for weapon in blueprint['Weapon']:\n",
" if weapon['DisplayName'] == 'Autocannon/2':\n",
@@ -997,23 +989,19 @@
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
"\n",
" # if weapon['DisplayName'] == 'Rotary Autocannon/10':\n",
" # if weapon['DisplayName'] == 'Rotary Autocannon/20':\n",
"\n",
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
" # if weapon['DisplayName'] == 'Rotary Autocannon/20':"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 224,
"id": "3d1cc8e3",
"metadata": {},
"outputs": [],
"source": [
"# Standardize clan weapon stats\n",
"\n",
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
" \n",
"for blueprint in blueprints: \n",
" if 'Weapon' in blueprint:\n",
" for weapon in blueprint['Weapon']:\n",
" if weapon['DisplayName'] == 'Clan Extended-Range Particle Projector Cannon':\n",
@@ -1151,23 +1139,40 @@
" weapon['BallisticArc'] = 'RULEUBA_HighArc'\n",
" weapon['WeaponCategory'] = 'Missile'\n",
" weapon['RangeCategory'] = 'UWRC_IndirectFire'\n",
" weapon['ProjectileId'] = '/mods/Supreme Mech Commander 2/projectiles/LRMMissile/LRMMissile_proj.bp'\n",
"\n",
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
" weapon['ProjectileId'] = '/mods/Supreme Mech Commander 2/projectiles/LRMMissile/LRMMissile_proj.bp'"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 225,
"id": "5a37054c",
"metadata": {},
"outputs": [],
"source": [
"# Apply speed multiplier\n",
"# increase rate of fire but keep dps consistent\n",
"\n",
"for blueprint in blueprints:\n",
" if 'Weapon' in blueprint and speed_mult != 0:\n",
" for weapon in blueprint['Weapon']:\n",
" if 'Damage' in weapon:\n",
" weapon['Damage'] /= speed_mult\n",
" if 'TargetCheckInterval' in weapon:\n",
" weapon['TargetCheckInterval'] *= speed_mult\n",
" if 'RateOfFire' in weapon:\n",
" weapon['RateOfFire'] *= speed_mult"
]
},
{
"cell_type": "code",
"execution_count": 226,
"id": "b63faa32",
"metadata": {},
"outputs": [],
"source": [
"# Cleanup\n",
"\n",
"for filepath in files:\n",
" blueprint = luadata.read(filepath)\n",
"\n",
"for idx, blueprint in enumerate(blueprints):\n",
" # blueprint.sort()\n",
" # blueprint['Air'].sort()\n",
" # blueprint['Audio'].sort()\n",
@@ -1180,18 +1185,18 @@
" # blueprint['Intel'].sort()\n",
" # blueprint['Veteran'].sort()\n",
"\n",
" # if 'Weapon' in blueprint:\n",
" # for weapon in blueprint['Weapon']:\n",
" # if weapon['MinRadius'] == 0:\n",
" # weapon.remove('MinRadius')\n",
" if 'Weapon' in blueprint:\n",
" for weapon in blueprint['Weapon']:\n",
" if 'MinRadius' in weapon and weapon['MinRadius'] == 0:\n",
" weapon.pop('MinRadius')\n",
" # weapon.sort()\n",
" \n",
" # luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
" luadata.write(files[idx], blueprint, indent=' ', prefix='UnitBlueprint ')"
]
},
{
"cell_type": "code",
"execution_count": 71,
"execution_count": 227,
"id": "f545b050",
"metadata": {},
"outputs": [],
@@ -1223,7 +1228,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": ".venv (3.11.3)",
"language": "python",
"name": "python3"
},