DIFF

class WeaponSource

Weapon InventoryItemSuper

script counterpart to engine's class Weapon

Methods 88

override bool IsWeapon()
proto native void Synchronize()

Force synchronizes the weapon state from Server to Client. Use with caution.

proto native int GetSlotFromMuzzleIndex(int muzzleIndex)

conversion muzzleIndex -> slotId

in muzzleIndex
muzzle index

Returns: slotId on success, -1 otherwise

proto native int GetCurrentMuzzle()

Returns: returns index of current muzzle

proto native int GetMuzzleModeCount(int muzzleIndex)
proto native void SetMuzzleMode(int muzzleIndex, int modeIndex)
proto native void SetNextMuzzleMode(int muzzleIndex)
proto native int GetCurrentModeBurstSize(int muzzleIndex)
proto native bool GetCurrentModeAutoFire(int muzzleIndex)
proto native int GetCurrentMode(int muzzleIndex)
proto native void SetCurrentMode(int muzzleIndex, int mode)
proto native owned string GetCurrentModeName(int muzzleIndex)
proto native bool CanFire(int muzzleIndex)

query whether the weapon can be fired or not

Returns: true if fire possible

proto native bool Fire(int muzzleIndex, vector pos, vector dir, vector speed)
proto native bool DryFire(int muzzleIndex)
proto native bool DryDryFire(int muzzleIndex)
proto native bool CreateRound(int muzzleIndex)

ejects round from chamber

proto native bool IsChamberJammed(int muzzleIndex)

detects presence of damaged cartridge in chamber

Returns: true if jammed

proto native bool IsChamberEjectable(int muzzleIndex)

detects presence of ejectable cartridge in muzzle's chamber

Returns: true if eject-able

bool IsChamberFullEx(int muzzleIndex)
References IsChamberFull()
proto native bool HasInternalMagazine(int muzzleIndex)

Returns: true if weapon has an internal magazine

Notepassing in -1 will check all muzzles
proto native int GetTotalCartridgeCount(int muzzleIndex)

Returns: returns number of available cartridges in chamber + internal magazine

proto native int GetTotalMaxCartridgeCount(int muzzleIndex)

Returns: returns number of max cartridges in chamber + internal magazine

proto native owned string GetRandomChamberableAmmoTypeName(int muzzleIndex)
in

Returns: returns the typename of a random ammo registered in 'chamberableFrom' in config

proto native owned string GetChamberAmmoTypeName(int muzzleIndex)
in

Returns: returns name of i-th ammo type for chambering

proto bool GetCartridgeInfo(int muzzleIndex, out float ammoDamage, out string ammoTypeName)

get info about the cartridge in the chamber of a muzzle

in muzzleIndex
out ammoDamage
damage of the ammo
out ammoTypeName
type name of the ejected ammo

Returns: true if info retrieved

proto bool GetInternalMagazineCartridgeInfo(int muzzleIndex, int cartridgeIndex, out float ammoDamage, out string ammoTypeName)

get info about the cartridge in the internal magazine of a muzzle

in muzzleIndex
in cartridgeIndex
has to be 0 <= cartridgeIndex < GetInternalMagazineCartridgeCount()
out ammoDamage
damage of the ammo
out ammoTypeName
type name of the ejected ammo

Returns: true if info retrieved

proto bool PopCartridgeFromChamber(int muzzleIndex, out float ammoDamage, out string ammoTypeName)

removes cartridge from chamber

proto native void EffectBulletShow(int muzzleIndex, float dmg, string type)

push effect cartridge to Weapon

in muzzleIndex
in ammoDamage
damage of the ammo
in ammoTypeName
type name of the ammo
proto native void SetGroundAnimFrameIndex(int groundAnimFrameIndex)

sets animation frame for ground state when animation is specified in config

proto bool PopCartridgeFromInternalMagazine(int muzzleIndex, out float ammoDamage, out string ammoTypeName)

removes top-most cartridge from internal magazine

proto native bool PushCartridgeToInternalMagazine(int muzzleIndex, float ammoDamage, string ammoTypeName)

push cartridge into internal magazine

proto native bool CanAttachMagazine(int muzzleIndex, Magazine mag)

query if a magazine can be attached to weapon

in muzzleIndex
in mag
magazine to attach

Returns: true if magazine can be attached

proto native bool TestAttachMagazine(int muzzleIndex, Magazine mag, bool do_occupancy_test, bool do_script_check)

query if a magazine can be attached to weapon

in muzzleIndex
in mag
magazine to attach
in do_occupancy_test
if false, skips test for presence of another magazine in weapon
in do_script_check
if false, skips script conditions

Returns: true if magazine can be attached

proto native bool AttachMagazine(int muzzleIndex, Magazine mag)

perform attachment of a magazine to weapon

in muzzleIndex
in mag
magazine to attach

Returns: true if magazine was attached

proto native bool CanChamberFromMag(int muzzleIndex, Magazine mag)

query if a bullet from magazine can be loaded into chamber

in muzzleIndex
in mag
magazine to load from

Returns: true if cartidge from mag can be put into chamber

proto native owned string GetChamberedCartridgeMagazineTypeName(int muzzleIndex)

query the type of magazine the cartridge can be unloaded to

in muzzleIndex

Returns: entity type name

proto native owned string GetRandomMagazineTypeName(int muzzleIndex)
in

Returns: returns the typename of a random magazine in 'magazines' in config

proto native owned string GetMaxMagazineTypeName(int muzzleIndex)
in

Returns: returns the typename of the magazine in 'magazines' in config with highest capacity

proto native int GetMagazineTypeCount(int muzzleIndex)
in

Returns: returns the number of magazines in 'magazines' in config

proto native bool EnterOptics()

switches to optics mode if possible

Returns: true if success, false otherwise

proto native bool IsInOptics()

is weapon in optics mode or not

Returns: true if in optics mode, false otherwise

proto native bool ExitOptics()

switches out of optics mode (if possible)

Returns: true if success, false otherwise

proto native float GetZoom()

returns current percentage of zoom

Returns: current percentage of zoom

proto native bool SetZoom(float percent)

sets current zoom (in %)

in percent
zoom to set in range [0.0f .. 100.0f]

Returns: true if zoom set

proto native bool ZoomIn()

moves current zoom by 1% up

Returns: true if zoom set

proto native bool ZoomOut()

moves current zoom by 1% down

Returns: true if zoom set

proto native int GetStepZoom()

returns position of currently used value in zoom config array

Returns: position of currently used value in zoom config array

proto native bool SetStepZoom(int step)

sets zoom to fov value defined at given position in zoom fov config array

in index
of configured step, range [0..cfg_max]

Returns: true if zoom set

proto native bool StepZoomIn()

sets zoom to next defined (respective to current) value in zoom fov config array

Returns: true if zoom set

proto native bool StepZoomOut()

sets zoom to previous (respective to current) defined value in zoom fov config array

Returns: true if zoom set

proto native int GetStepZeroing(int muzzleIndex = 0)

returns position of currently used value in zeroing config array

Returns: position of currently used value in zeroing config array

proto native bool SetStepZeroing(int muzzleIndex, int step)

sets zeroing to value defined at given position in zeroing config array

in index
of zeroing to set [0..cfg_max]

Returns: true if zeroing set

proto native bool StepZeroingUp(int muzzleIndex = 0)

sets zeroing to next defined (respective to current) value in zeroing config array

Returns: true if zeroing set

proto native bool StepZeroingDown(int muzzleIndex = 0)

sets zeroing to previous (respective to current) defined value in zeroing config array

Returns: true if zeroing set

proto native float GetCurrentZeroing(int muzzleIndex = 0)

returns currently used value of zeroing in config array of weapon or attached optics

Returns: currently used value in zeroing

proto native float GetZeroingClamp(int muzzleIndex = 0)

returns maximum allowed discrete distance for the muzzle. Limits attached optics zeroing only! '0' if unclamped

Returns: maximum allowed discrete distance for the muzzle

proto native bool FlashlightOn()

attempt to turn on flashlight

Returns: true if set on, false otherwise (no flashlight, no power, etc)

proto native bool FlashlightOff()

attempt to turn off flashlight

Returns: true if on -> off, false otherwise (no flashlight, no power, etc, already off)

proto native bool IsFlashlightOn()

query state of flashlight

Returns: true if set on

proto native UnderSlugLauncher GetAttachedLauncher()

Returns: returns attached launcher or null

proto native ItemSuppressor GetAttachedSuppressor()

Returns: returns attached suppressor or null

proto native void GetCameraPoint(int muzzleIndex, out vector pos, out vector dir)

gets camera position & direction in model space of weapon entity

proto native float GetZoomInit(int muzzleIndex)

gets FOV value, when entering optics

proto native float GetZoomMin(int muzzleIndex)

gets FOV minimum

proto native float GetZoomMax(int muzzleIndex)

gets FOV maximum

proto native float GetZeroingDistanceZoomMin(int muzzleIndex)

Gets Zeroing distance at opticsZoomMin

proto native float GetZeroingDistanceZoomMax(int muzzleIndex)

Gets Zeroing distance at opticsZoomMax

proto native void SelectionMagazineShow()
proto native void SelectionMagazineHide()
void StepZeroingUpAllMuzzles()
void StepZeroingDownAllMuzzles()