Weapon Framework
A toolkit for adding weapons to Stick Fight: models, behaviours, effects and sounds, with 12 new weapon categories and modded weapons all on Menu Overhaul's WEAPONS screen. Local play only.
By maewing
| Date uploaded | 4 days ago |
| Version | 1.0.1 |
| Download link | maewing-Weapon_Framework-1.0.1.zip |
| Downloads | 24 |
| Dependency string | maewing-Weapon_Framework-1.0.1 |
This mod requires the following mods to function
SFTG_Modding-BepInExPack_SFTG
Stick Fight: The Game-specific BepInEx x64 5.4.23.5. Preconfigured and ready to use.
Preferred version: 1.1.1maewing-Menu_Overhaul
Graphics settings, controller layouts for every player at once, two-pane MAPS and WEAPONS screens with previews and stats, a MODS page, and a pause menu that works with a gamepad. Keeps the game's look.
Preferred version: 1.0.0README
Weapon Framework
A toolkit for adding weapons to Stick Fight, and the system that puts them in the game: categories, spawning and saving. Needs Menu Overhaul, whose WEAPONS screen (with its close-ups and stats) is where you pick them.
For players
On its own, Weapon Framework adds no weapons: it's what weapon mods are built on. What it changes for you:
- 12 new categories on Menu Overhaul's WEAPONS screen instead of the game's basic ones: Pistols, Rifles, Shotguns, Heavy, Explosives, Melee, Control, Gadgets, Party, Lava, Snake and Godlike.
- Modded weapons on the same screen: weapons from mods built on the framework slot into those categories (or into categories of their own), marked MOD, with their own close-ups, stats and notes, and spawn like the game's.
- Your choices are kept per weapon (
BepInEx\config\WeaponFramework.menu.txt). Your old choices from the game's weapon screen are carried over the first time. The game's own saved settings are never touched, so removing the mod brings back your old choices exactly as they were. - Spawn odds are the game's. With Spawn Rate Changer 1.1.0 or later installed, every weapon, modded ones included, shows its share of the drops and gets a ticket slider (Left/Right, Y for the default).
Custom sounds
Any weapon's sounds (the game's too) can be replaced by dropping .wav files into BepInEx\config\WeaponFramework\Sounds\<weapon>\: shoot*.wav, draw*.wav, drop*.wav, and an optional sound.txt with volume = 0.8 / pitch = 1.1. The folder name is the weapon's id or name; weapons.txt in the Sounds folder lists them all.
Online
Local play only. In online matches only the game's own weapons spawn, at the game's own odds.
For modders
Add WeaponFramework.dll as a reference (the WeaponFramework.xml next to it gives you the docs in your editor) and [BepInDependency(WeaponFramework.Plugin.Guid)] to your plugin. Then, in your plugin's Awake:
WeaponRegistry.Add(new WeaponDefinition("mymod.katana", "KATANA", VanillaWeapon.Sword)
{
Category = WeaponCategory.Melee, // or your own: WeaponRegistry.AddCategory("mymod.blades", "BLADES")
Rarity = 5, // spawn tickets: basic guns are 20, the Sniper 5, the God Pistol 2
Ammo = 6,
Model = new WeaponModel { Grip = new Vector3(0, 0, -0.2f) }
.Box(new Vector3(0, 0, -0.2f), new Vector3(0.07f, 0.08f, 0.5f)) // handle
.Box(new Vector3(0, 0, 0.9f), new Vector3(0.04f, 0.07f, 1.7f)).Paint(GameMaterials.Blink), // blade
Behaviour = typeof(MyKatana),
ShootSounds = Sounds.LoadFolder(Path.Combine(myFolder, "swing")),
});
class MyKatana : WeaponBehaviour
{
public override bool OnAttack()
{
DashResult d = Moves.Dash(Owner, Aim, 8f);
foreach (PlayerHit h in Hits.AlongLine(Owner, d.From, d.To, 0.8f))
Hits.Damage(Owner, h, 50f, Aim, 10f);
Fx.Streak(d.From, d.To, Players.ColorOf(Owner));
Moves.Hang(Owner, 0.4f);
return true; // replaces the sword's own swing
}
}
What you get:
- Weapons: copy any game weapon and change it (
Base,Configure,Cooldown,Ammo), or put one of the game's unused weapons in the menu (WeaponDefinition.FromExisting). Models are built from boxes, cylinders, discs and balls in the game's own flat style (WeaponModel), held and as spinning pickups. - Hooks (
WeaponBehaviour):OnAttack,AfterAttack,OnAttackHeld/Released, a free alternative fire on the block button (OnAltPressed/Held/Released),OnShot(the projectile),ModifyDamage,OnDamageDealt,OnEquip/OnUnequip. Hold-to-charge withChargeTime. - Toolkit:
Projectile(your own bullets, bombs, hooks: gravity, bounces, sticking, blocking),GameShots(fire or tweak the game's own bullets),Blast(the game's explosion, your own, or a ring),Hits(lines and areas, respecting blocks),Moves(dash, teleport, hang, push),Status(stun, burn, poison, flipped controls, pinning),Deployable(mines, traps, turrets, owner-coloured lights),Deflect(surfaces that bounce bullets),Rope,Fx(streaks, slashes, flashes, afterimages, screen shake),Looks,Sounds(WAV loading, borrowing game sounds). - Registry:
WeaponRegistry(add, look up, rename, recategorise, set default tickets, switch on/off,ReadyandPlayerArmedevents),SpawnWeights(become the one provider of custom per-weapon spawn odds). - Debug keys (
[Debug] DebugKeys = truein the config):]/[give player 1 the next or previous weapon,\drops a pickup of player 1's weapon,'slow motion,-training (nobody can die from damage, and every hit is logged with its damage),=lines the other players up as targets,/fires a bullet at player 1,.pulls a target in front of player 1,`prints every weapon's stats.[Debug] Give= a weapon id or name hands it to player 1 straight away. With debug keys on when the game starts, every log line also goes toBepInEx\WeaponFramework-debug.logimmediately.
CHANGELOG
Changelog
1.0.6
- Fixed leftover parts of the game's weapon showing next to a modded weapon's own model when that game weapon keeps parts inside a group (the Minigun's barrels): they're now removed like its other parts, in the hand, on the pickup and on the WEAPONS screen.
1.0.5
- Weapon presets on the WEAPONS screen: LT (P on the keyboard) switches between CUSTOM (your own choices), ALL, MELEE, PISTOLS, SHOTGUNS, SNIPERS, EXPLOSIVES and CRAZY, applied at once. Your own choices are kept and come back when you pick CUSTOM again; ticket values are never changed; switching a weapon on or off by hand makes it CUSTOM again. Weapons from other mods join a preset by their category.
1.0.4
- Fixed a crash when a modded weapon ran out of ammo and was thrown away (the thrown-away copy got an invalid mass setting).
- Ice and other breakable map pieces now break under modded projectiles and explosions, like under the game's bullets. For modders:
Hits.BreakandHits.BreakAlong(for beams and cuts). - The game's own weapons always keep their own look: if anything swaps a material on one of their parts, it's put back (and logged).
- The look guard also removes extra parts that end up on a game weapon (or on the player template that new players copy) and restores colours or pictures changed on the game weapons' own materials. It checks when a weapon is taken out and when the WEAPONS screen shows it, and logs each fix once. Parts the game keeps hidden (the Pistol's orange rear box) are switched back off, even on a weapon that's being held.
WeaponBehaviour.SetVisible(true)no longer shows parts that the model keeps hidden.- Debug:
[Debug] SpawnFromMenu(off by default): RT on the WEAPONS screen closes the menu and puts the highlighted weapon in your hands. Local play only.
1.0.3
- Every game weapon on the WEAPONS screen has a description now (the snake weapons keep theirs, which change with PoisonGuns).
- Modded weapons no longer push against the player holding them (their parts used to shove the hand and arm, so some drooped off the aim or dragged their holder along).
- Modded weapons built on the Sword or Spear now shoot, throw and attach things from their model's muzzle instead of from the hand (those bases have no muzzle of their own).
- Look-only model parts built while a weapon is picked up (
WeaponModels.BuildfromOnEquip, e.g. a flail's chain) no longer keep a collider. - For modders:
WeaponDefinition.Statssets what the WEAPONS screen shows (e.g. the real damage of a weapon that deals its own, instead of the numbers of the weapon it's built on). - For modders:
Deflect.Addcan take a function that picks where each deflected shot goes (e.g. at the nearest opponent), for the game's bullets and the framework's projectiles alike.
1.0.2
- The WEAPONS screen's preview shows a modded weapon's own model even before any player has carried it, instead of the weapon it was built from (Blink Katana showed as the sword).
1.0.1
- The Bouncer is now under RIFLES instead of SHOTGUNS.
- A category switched off on the weapons screen now always stops its weapons spawning, also when a weapon mod spells the category's id with different capitals. Moving a weapon to another category (
WeaponRegistry.SetCategory) now applies to the spawns straight away. - A weapon whose pickup couldn't be made is left out of the spawns instead of making the game throw an error each time it was drawn.
- A modded weapon that runs out of ammo no longer leaves its code running on the dropped copy until the map changes.
- Smoother with many modded weapons around: held weapons' hooks, the framework's projectiles and placed gadgets (mines, traps) make far less garbage each frame.
- A weapon mod's hook that throws an error is reported once instead of every frame; the same for a spawn-weight provider failing on a weapon.
1.0.0
- First release.
- 12 weapon categories and modded weapons (marked MOD) on Menu Overhaul's WEAPONS screen (Menu Overhaul is required), with choices saved per weapon.
- Drop chances and ticket sliders on every weapon with Spawn Rate Changer 1.1.0 or later.
- An API for adding weapons and categories: models, hooks, alternative fire, charging, projectiles, explosions, deployables, status effects, deflection, effects and sounds.
- Custom sounds for any weapon from a folder of .wav files.
- Debug keys and a training mode for making weapons.
- Local play only: online matches use the game's own weapons and odds.