BaseWeaponModelclass
Marks up a weapon's view or world model with the attachment points the weapon fires from - the muzzle, the shell-eject port, and so on - and plays the stock presentation off them: muzzle flash, brass and tracer prefabs, plus the b_deploy/b_attack/b_reload animation parameters. Drop this on a weapon model prefab, wire the attachment GameObjects, and override the On* hooks to extend or replace any of it. The holding `Sandbox.BaseCombatWeapon` drives it through those hooks.
Constructors1
Showing 1 constructors
public BaseWeaponModel()
No results match this filter.
Methods12
Showing 12 methods
public void DoEjectBrass()
Spawns `Sandbox.BaseWeaponModel.EjectBrass` at the shell-eject attachment and throws it out, if both are set.
void—public void DoMuzzleEffect()
Spawns `Sandbox.BaseWeaponModel.MuzzleEffect` parented to the muzzle attachment, if both are set.
void—public void DoTracerEffect(Vector3 hitPoint, System.Nullable`1<Vector3> origin = null)
| Parameter | Type | Description |
|---|---|---|
| hitPoint | Vector3 | — |
| origin = null | Nullable<Vector3> | — |
void—public Transform GetMuzzleTransform()
The muzzle world transform, or the model's own transform when there's no muzzle attachment.
public Transform GetShellEjectTransform()
The shell-eject world transform, or the model's own transform when there's no eject attachment.
public virtual void OnAttack(System.Nullable`1<Vector3> hitPoint = null, System.Nullable`1<Vector3> origin = null)
| Parameter | Type | Description |
|---|---|---|
| hitPoint = null | Nullable<Vector3> | — |
| origin = null | Nullable<Vector3> | — |
void—public virtual void OnDeploy()
Called when this weapon model is deployed (drawn). Base sets the "b_deploy" animation parameter and plays `Sandbox.BaseWeaponModel.DeploySound`. Override to extend.
void—public virtual void OnIncrementalReload()
Called when a round is loaded during an incremental (one-at-a-time) reload. Base does nothing - override for the per-shell animation.
void—public virtual void OnReloadCancel()
Called when a reload is cancelled part-way through. Base does nothing - override to stop timed sounds and so on.
void—public virtual void OnReloadFinish()
Called when the reload finishes. Base clears the "b_reload" animation parameter. Override to extend.
void—public virtual void OnReloadStart()
Called when the weapon starts reloading. Base sets the "b_reload" animation parameter. Override to extend (incremental animations, timed reload sounds).
void—No results match this filter.
Properties7
Showing 7 properties
public Sandbox.SoundEvent Sandbox.BaseWeaponModel.DeploySound { get; set; }
Sound played when this weapon model is deployed (drawn).
public Sandbox.GameObject Sandbox.BaseWeaponModel.EjectBrass { get; set; }
Effect prefab spawned at the shell-eject port when the weapon fires (the flying brass). Defaults to a generic casing - clear it for none.
public Sandbox.GameObject Sandbox.BaseWeaponModel.MuzzleEffect { get; set; }
Effect prefab spawned at the muzzle when the weapon fires (muzzle flash, smoke). Defaults to a generic flash - clear it for none.
public Sandbox.GameObject Sandbox.BaseWeaponModel.MuzzleGameObject { get; set; }
The muzzle attachment - where shots and muzzle effects originate.
public Sandbox.SkinnedModelRenderer Sandbox.BaseWeaponModel.Renderer { get; set; }
The skinned model renderer for this weapon model.
public Sandbox.GameObject Sandbox.BaseWeaponModel.ShellEjectGameObject { get; set; }
The shell-eject attachment - where spent casings are thrown from.
public Sandbox.GameObject Sandbox.BaseWeaponModel.TracerEffect { get; set; }
Effect prefab spawned from the muzzle toward the hit point (the bullet tracer). Defaults to a generic tracer - clear it for none.
No results match this filter.