Content API

Python SDK

The authoring helpers modsdk.py gives your build script.

The SDK runner supplies Mod to your script; keep your instance named mod. Every helper just emits content operations, so anything here can also be written as raw JSON.

HelperDoes
Mod(id, name, description=…)Starts a mod
mod.tower(name, base, **patch)Clones a tower; returns a handle
mod.existing_tower(id)Handle for a native tower (for .shop, .stats, .upgrade)
tower.projectile(**fields)Edits a weapon's projectile (or takes a template)
tower.weapon(rate=…)Edits a weapon; rate is seconds between shots
tower.stats(**fields)Edits the tower definition
tower.upgrade(path, tier, …)Edits one upgrade and its later states
tower.shop(before|after|index, category, visible)Places the tower in the shop
tower.model(name)Uses a custom baked model
mod.projectile(name, base_tower, **fields)Reusable projectile template
mod.bloon(name, base, **patch)Clones a bloon
mod.mode(name, base, **patch)Clones a mode
mod.all_modes(**patch)Patches every mode so far
mod.set(path, value)Raw JSON Pointer write
mod.insert(path, index, value) / mod.remove(path, index)Array edits
mod.menu(page, path, text=…, visible=…)Menu node edit
mod.model(name)Reference to a baked model in your assets
mod.script(name, file=…, tick_interval=…)Embeds a Rhai event script

Tiers, attacks and weapons

Projectile and weapon helpers default to tier 000, attack 0 and weapon 0. Pass tier="100", attack= or weapon= to edit others. Upgraded tiers keep their inherited values unless you edit them too.

dart = mod.tower("dart", base="DartMonkey", cost=100)
dart.projectile(damage=3, pierce=4)               # base tier
dart.projectile(tier="100", damage=4)             # after the first top-path upgrade
dart.weapon(rate=0.5)

Projectile templates

bomb = mod.projectile("big-bomb", base_tower="BombShooter", damage=10)
dart.projectile(bomb, pierce=30)

A template copies the complete native projectile, including its behaviour models, then applies your overrides. Projectiles are compiled native data attached to weapons; they aren't Python objects or callbacks during play.

Unofficial fan project. Not affiliated with Ninja Kiwi. rusttd6.com