GizStackGizStack
View .mdOpen in ChatGPTOpen in Claude

gizgame/guns

What a game of the stock guns (gizgame/game GUNS) declares besides its kinds: their models and the sounds they fire with.

gizlang
import * as Guns from "gizgame/guns";

Constants

GUN_THINGS

gizlang
const GUN_THINGS: Vec<Thing3D> = [["rifle", "Bgvuu4CUMV"], ["carbine", "K2lXTYFSLC"], ["smg", "7ehatxr7FY"], ["shotgun", "ZmPTnh7njL"], ["sniper", "ASOMZIErq3"], ["marksman", "TKaBjAEofL"], ["pistol", "J3i9KDQ3kt"], ["revolver", "E7IaG9TptR"]].map((g: Vec<string>): Thing3D => ({ name: g[0], file: `${g[1] }/model.glb`, most: 1, casts: false }))

The stock guns' models (Poly Pizza, CC0), each named as its gun's THING: a map of a game of them lists these among its things, and the game's lock pins their files (giz assets add LOCK polypizza:ID).

GUN_SOUNDS

gizlang
const GUN_SOUNDS: Map<string, Sound> = { rifle: { seconds: 0.3, layers: [{ wave: "noise", cut: 1, decay: 34, gain: 0.5 }, { from: 210, to: 55, glide: 34, decay: 20, gain: 0.34 }], gain: 0.5 }, smg: { seconds: 0.2, layers: [{ wave: "noise", cut: 1, decay: 52, gain: 0.42 }, { from: 300, to: 90, glide: 40, decay: 30, gain: 0.24 }], gain: 0.42 }, shotgun: { seconds: 0.6, layers: [{ wave: "noise", cut: 0.6, decay: 12, gain: 0.7 }, { from: 130, to: 36, glide: 14, decay: 8, gain: 0.5 }], gain: 0.7 }, sniper: { seconds: 0.9, layers: [{ wave: "noise", cut: 0.8, decay: 9, gain: 0.6 }, { from: 160, to: 30, glide: 9, decay: 5, gain: 0.55 }], gain: 0.8 }, pistol: { seconds: 0.25, layers: [{ wave: "noise", cut: 1, decay: 44, gain: 0.4 }, { from: 260, to: 80, glide: 36, decay: 26, gain: 0.3 }], gain: 0.5 } }

The sounds the stock guns fire with: a game of them declares these (Game.sounds).