byond - Modules - TypesVar Details - Proc Details

gun

Vars

PB_burst_bullets_firedWhen PB burst firing and handing off to /fire after a target moves out of range, this is how many bullets have been fired.
accuracy_multMultiplier. Increased and decreased through attachments. Multiplies the projectile's accuracy by this number.
accuracy_mult_unwieldedMultiplier. Increased and decreased through attachments. Multiplies the projectile's accuracy when unwielded by this number.
active_attachableThis will link to one of the attachments, or remain null.
aim_slowdownSelf explanatory. How much does aiming (wielding the gun) slow you
ammoHow the bullet will behave once it leaves the gun, also used for basic bullet damage and effects, etc. Ammo will be replaced on New() for things that do not use mags.
attachable_allowedMust be the exact path to the attachment present in the list. Empty list for a default.
attachable_offsetIs a list, see examples of from the other files. Initiated on New() because lists don't initial() properly.
attachable_overlaysList of overlays so we can switch them in an out, instead of using Cut() on overlays.
attachmentsList of all current attachments on the gun.
autofire_slow_multThe multiplier for how much slower this should fire in automatic mode. 1 is normal, 1.2 is 20% slower, 2 is 100% slower, etc. Protected due to it never needing to be edited.
automaticUsed to determine if you can target multiple people.
base_gun_iconthe default gun icon_state. change to reskin the gun
burst_amountHow many shots can the weapon shoot in burst? Anything less than 2 and you cannot toggle burst. Use modify_burst_amount and set_burst_amount instead of modifying this
burst_delayThe delay in between shots. Lower = less delay = faster. Use modify_burst_delay and set_burst_delay instead of modifying this
burst_scatter_multMultiplier. Increases or decreases how much bonus scatter is added with each bullet during burst fire (wielded only).
caliberDetermines what kind of bullet is created when the gun is unloaded - used to match rounds to magazines. Set automatically when reloading.
cock_cooldownworld.time value, to prevent COCK COCK COCK COCK
cock_delayDelay before we can cock again, in tenths of seconds
damage_buildup_multMultiplier. Increased and decreased through attachments. Multiplies the projectile's damage bleed (buildup) by this number.
damage_falloff_multMultiplier. Increased and decreased through attachments. Multiplies the projectile's damage bleed (falloff) by this number.
damage_multMultiplier. Increased and decreased through attachments. Multiplies the projectile's damage by this number.
delay_styleDetermines what happens when you fire a gun before its wield or pull time has finished. This one is extra scatter and an acc. malus.
effective_range_maxWhat maximum range the weapon deals full damage, tapers off using damage_falloff after hitting this value. 0 for no maximum.
effective_range_minWhat minimum range the weapon deals full damage, builds up the closer you get. 0 for no minimum.
extra_delayWhen burst-firing, this number is extra time before the weapon can fire again. Depends on number of rounds fired.
fa_firingWhether or not the gun is firing full-auto
fa_max_scatterHow bad does the scatter get on full auto?
fa_paramsClick parameters to use when firing full-auto
fa_scatter_peakHow many full-auto shots to get to max scatter?
fire_delayFor regular shots, how long to wait before firing again. Use modify_fire_delay and set_fire_delay instead of modifying this on the fly
fire_delay_groupThe group or groups of the gun where a fire delay is applied and the delays applied to each group when the gun is dropped after being fired
fire_rattleDoes our gun have a unique empty mag sound? If so use instead of pitch shifting.
fire_soundsIf fire_sound is null, it will pick a sound from the list here instead.
guaranteed_delay_timeStoring value for guaranteed delay
gun_categoryOnly guns of the same category can be fired together while dualwielding.
gun_firemodeCurrent selected firemode of the gun.
gun_firemode_listList of allowed firemodes.
gun_userCurrent user (holding) of the gun. Set with set_gun_user()
has_empty_iconwhether gun has icon state of (base_gun_icon)_e
has_open_iconwhether gun has icon state of (base_gun_icon)_o
in_chamberWhat is currently in the chamber. Most guns will want something in the chamber upon creation.
last_firedWhen it was last fired, related to world.time.
last_moved_mobUsed to fire faster at more than one person.
movement_onehanded_acc_penalty_multMultiplier. Increased and decreased through attachments. Multiplies the accuracy/scatter penalty of the projectile when firing onehanded while moving.
muzzle_flash_colorColor of the muzzle flash light effect.
muzzle_flash_lummuzzle flash brightness
projectile_typeThe type of projectile that this gun should shoot
pull_timeStoring value for how long pulling a gun takes before you can use it
random_muzzle_chanceChance for random spawn to give this gun a muzzle attachment.
random_rail_chanceChance for random spawn to give this gun a rail attachment.
random_spawn_chanceChance for random attachments to spawn in general.
random_spawn_muzzleUsed when a gun will have a chance to spawn with attachments.
random_spawn_stockUsed when a gun will have a chance to spawn with attachments.
random_spawn_underUsed when a gun will have a chance to spawn with attachments.
random_stock_chanceChance for random spawn to give this gun a stock attachment.
random_under_chanceChance for random spawn to give this gun a underbarrel attachment.
recoilScreen shake when the weapon is fired.
recoil_buildupThe recoil on a dynamic recoil gun
recoil_buildup_limitThe limit at which the recoil on a gun can reach. Usually the maximum value
recoil_loss_per_secondHow much recoil_buildup is lost per second. Builds up as time passes, and is set to 0 when a single shot is fired
recoil_unwieldedMultiplier. Increased and decreased through attachments. Multiplies the gun's recoil when unwielded by this number.
scatterHow much the bullet scatters when fired.
scatter_unwieldedMultiplier. Increased and decreased through attachments. Multiplies the projectile's scatter when the gun is unwielded by this number.
shots_firedHow many bullets the gun fired while bursting/auto firing
start_automaticIf this gun should spawn with automatic fire. Protected due to it never needing to be edited.
start_semiautoIf this gun should spawn with semi-automatic fire. Protected due to it never needing to be edited.
starting_attachment_typesWhat attachments this gun starts with THAT CAN BE REMOVED. Important to avoid nuking the attachments on restocking! Added on New()
targetCurrently selected target to fire at. Set with set_target()
told_cant_shootSo that it doesn't spam them with the fact they cannot hit them.
traits_to_give
velocity_addAdded velocity to fired bullet.
wield_delayHow long between wielding and firing in tenths of seconds
wield_timeStoring value for wield delay.

Procs

add_bullet_traits@bullet_trait_entries: A list of bullet trait entries
change_targetUpdate the target if you draged your mouse
clean_targetSet the target to its turf, so we keep shooting even when it was qdeled
fire_wrapperWrapper proc for the autofire subsystem to ensure the important args aren't null
force_lightIf this gun has a relevant flashlight attachable attached, (de)activate it
get_fire_delaygetter for fire_delay
get_gun_userGetter for gun_user
has_ammunitionReturns TRUE if the weapon is loaded. Separate proc because there's no single way to check this for all weapons: chamber isn't always loaded, not all weapons use normal magazines etc. load_into_chamber() itself is designed to be called immediately before firing, and isn't suitable.
is_civilian_usableReturns one of the two override values if either are null, preferring the argument value. Otherwise, returns TRUE if it is in a civilian usable category (Handguns or SMGs), FALSE if it is not.
light_sourcescheck if the gun contains any light source that is currently turned on.
load_into_chamberload_into_chamber(), reload_into_chamber(), and clear_jam() do all of the heavy lifting. If you need to change up how a gun fires, just change these procs for that subtype and you're good to go.
modify_burst_amountadder for burst_amount
modify_burst_delayAdder for burst_delay
modify_fire_delayadder for fire_delay
remove_bullet_traits@bullet_traits: A list of bullet trait typepaths or ids
reset_fireClean all references
reset_light_rangecalled by a timer to remove the light range from muzzle flash
set_auto_firingSetter proc for fa_firing
set_bullet_traitsPopulate traits_to_give in this proc
set_burst_amountsetter for burst_amount
set_burst_delaySetter for burst_delay
set_burstingSetter proc to toggle burst firing
set_fire_delaysetter for fire_delay
set_targetSet the target and take care of hard delete
start_fireCheck if the gun can fire and add it to bucket auto_fire system if needed, or just fire the gun if not
turn_off_lightThis function actually turns the lights on the gun off
unload_chamberUnload a chambered round, if one exists, and empty the chamber.

Var Details

PB_burst_bullets_fired

When PB burst firing and handing off to /fire after a target moves out of range, this is how many bullets have been fired.

accuracy_mult

Multiplier. Increased and decreased through attachments. Multiplies the projectile's accuracy by this number.

accuracy_mult_unwielded

Multiplier. Increased and decreased through attachments. Multiplies the projectile's accuracy when unwielded by this number.

active_attachable

This will link to one of the attachments, or remain null.

aim_slowdown

Self explanatory. How much does aiming (wielding the gun) slow you

ammo

How the bullet will behave once it leaves the gun, also used for basic bullet damage and effects, etc. Ammo will be replaced on New() for things that do not use mags.

attachable_allowed

Must be the exact path to the attachment present in the list. Empty list for a default.

attachable_offset

Is a list, see examples of from the other files. Initiated on New() because lists don't initial() properly.

attachable_overlays

List of overlays so we can switch them in an out, instead of using Cut() on overlays.

attachments

List of all current attachments on the gun.

autofire_slow_mult

The multiplier for how much slower this should fire in automatic mode. 1 is normal, 1.2 is 20% slower, 2 is 100% slower, etc. Protected due to it never needing to be edited.

automatic

Used to determine if you can target multiple people.

base_gun_icon

the default gun icon_state. change to reskin the gun

burst_amount

How many shots can the weapon shoot in burst? Anything less than 2 and you cannot toggle burst. Use modify_burst_amount and set_burst_amount instead of modifying this

burst_delay

The delay in between shots. Lower = less delay = faster. Use modify_burst_delay and set_burst_delay instead of modifying this

burst_scatter_mult

Multiplier. Increases or decreases how much bonus scatter is added with each bullet during burst fire (wielded only).

caliber

Determines what kind of bullet is created when the gun is unloaded - used to match rounds to magazines. Set automatically when reloading.

cock_cooldown

world.time value, to prevent COCK COCK COCK COCK

cock_delay

Delay before we can cock again, in tenths of seconds

damage_buildup_mult

Multiplier. Increased and decreased through attachments. Multiplies the projectile's damage bleed (buildup) by this number.

damage_falloff_mult

Multiplier. Increased and decreased through attachments. Multiplies the projectile's damage bleed (falloff) by this number.

damage_mult

Multiplier. Increased and decreased through attachments. Multiplies the projectile's damage by this number.

delay_style

Determines what happens when you fire a gun before its wield or pull time has finished. This one is extra scatter and an acc. malus.

effective_range_max

What maximum range the weapon deals full damage, tapers off using damage_falloff after hitting this value. 0 for no maximum.

effective_range_min

What minimum range the weapon deals full damage, builds up the closer you get. 0 for no minimum.

extra_delay

When burst-firing, this number is extra time before the weapon can fire again. Depends on number of rounds fired.

fa_firing

Whether or not the gun is firing full-auto

fa_max_scatter

How bad does the scatter get on full auto?

fa_params

Click parameters to use when firing full-auto

fa_scatter_peak

How many full-auto shots to get to max scatter?

fire_delay

For regular shots, how long to wait before firing again. Use modify_fire_delay and set_fire_delay instead of modifying this on the fly

fire_delay_group

The group or groups of the gun where a fire delay is applied and the delays applied to each group when the gun is dropped after being fired

Guns with this var set will apply the gun's remaining fire delay to any other guns in the same group

Set as null (does not apply any fire delays to any other gun group) or a list of fire delay groups (string defines) matched with the corresponding fire delays applied

fire_rattle

Does our gun have a unique empty mag sound? If so use instead of pitch shifting.

fire_sounds

If fire_sound is null, it will pick a sound from the list here instead.

guaranteed_delay_time

Storing value for guaranteed delay

gun_category

Only guns of the same category can be fired together while dualwielding.

gun_firemode

Current selected firemode of the gun.

gun_firemode_list

List of allowed firemodes.

gun_user

Current user (holding) of the gun. Set with set_gun_user()

has_empty_icon

whether gun has icon state of (base_gun_icon)_e

has_open_icon

whether gun has icon state of (base_gun_icon)_o

in_chamber

What is currently in the chamber. Most guns will want something in the chamber upon creation.

last_fired

When it was last fired, related to world.time.

last_moved_mob

Used to fire faster at more than one person.

movement_onehanded_acc_penalty_mult

Multiplier. Increased and decreased through attachments. Multiplies the accuracy/scatter penalty of the projectile when firing onehanded while moving.

muzzle_flash_color

Color of the muzzle flash light effect.

muzzle_flash_lum

muzzle flash brightness

projectile_type

The type of projectile that this gun should shoot

pull_time

Storing value for how long pulling a gun takes before you can use it

random_muzzle_chance

Chance for random spawn to give this gun a muzzle attachment.

random_rail_chance

Chance for random spawn to give this gun a rail attachment.

random_spawn_chance

Chance for random attachments to spawn in general.

random_spawn_muzzle

Used when a gun will have a chance to spawn with attachments.

random_spawn_stock

Used when a gun will have a chance to spawn with attachments.

random_spawn_under

Used when a gun will have a chance to spawn with attachments.

random_stock_chance

Chance for random spawn to give this gun a stock attachment.

random_under_chance

Chance for random spawn to give this gun a underbarrel attachment.

recoil

Screen shake when the weapon is fired.

recoil_buildup

The recoil on a dynamic recoil gun

recoil_buildup_limit

The limit at which the recoil on a gun can reach. Usually the maximum value

recoil_loss_per_second

How much recoil_buildup is lost per second. Builds up as time passes, and is set to 0 when a single shot is fired

recoil_unwielded

Multiplier. Increased and decreased through attachments. Multiplies the gun's recoil when unwielded by this number.

scatter

How much the bullet scatters when fired.

scatter_unwielded

Multiplier. Increased and decreased through attachments. Multiplies the projectile's scatter when the gun is unwielded by this number.

shots_fired

How many bullets the gun fired while bursting/auto firing

start_automatic

If this gun should spawn with automatic fire. Protected due to it never needing to be edited.

start_semiauto

If this gun should spawn with semi-automatic fire. Protected due to it never needing to be edited.

starting_attachment_types

What attachments this gun starts with THAT CAN BE REMOVED. Important to avoid nuking the attachments on restocking! Added on New()

target

Currently selected target to fire at. Set with set_target()

told_cant_shoot

So that it doesn't spam them with the fact they cannot hit them.

traits_to_give

velocity_add

Added velocity to fired bullet.

wield_delay

How long between wielding and firing in tenths of seconds

wield_time

Storing value for wield delay.

Proc Details

add_bullet_traits

@bullet_trait_entries: A list of bullet trait entries

change_target

Update the target if you draged your mouse

clean_target

Set the target to its turf, so we keep shooting even when it was qdeled

fire_wrapper

Wrapper proc for the autofire subsystem to ensure the important args aren't null

force_light

If this gun has a relevant flashlight attachable attached, (de)activate it

get_fire_delay

getter for fire_delay

get_gun_user

Getter for gun_user

has_ammunition

Returns TRUE if the weapon is loaded. Separate proc because there's no single way to check this for all weapons: chamber isn't always loaded, not all weapons use normal magazines etc. load_into_chamber() itself is designed to be called immediately before firing, and isn't suitable.

is_civilian_usable

Returns one of the two override values if either are null, preferring the argument value. Otherwise, returns TRUE if it is in a civilian usable category (Handguns or SMGs), FALSE if it is not.

light_sources

check if the gun contains any light source that is currently turned on.

load_into_chamber

load_into_chamber(), reload_into_chamber(), and clear_jam() do all of the heavy lifting. If you need to change up how a gun fires, just change these procs for that subtype and you're good to go.

modify_burst_amount

adder for burst_amount

modify_burst_delay

Adder for burst_delay

modify_fire_delay

adder for fire_delay

remove_bullet_traits

@bullet_traits: A list of bullet trait typepaths or ids

reset_fire

Clean all references

reset_light_range

called by a timer to remove the light range from muzzle flash

set_auto_firing

Setter proc for fa_firing

set_bullet_traits

Populate traits_to_give in this proc

set_burst_amount

setter for burst_amount

set_burst_delay

Setter for burst_delay

set_bursting

Setter proc to toggle burst firing

set_fire_delay

setter for fire_delay

set_target

Set the target and take care of hard delete

start_fire

Check if the gun can fire and add it to bucket auto_fire system if needed, or just fire the gun if not

turn_off_light

This function actually turns the lights on the gun off

unload_chamber

Unload a chambered round, if one exists, and empty the chamber.