attachable

- Gun attachable items code. Lets you add various effects to firearms.
Some attachables are hardcoded in the projectile firing system, like grenade launchers, flamethrowers.
When you are adding new guns into the attachment list, or even old guns, make sure that said guns properly accept overlays. You can find the proper offsets in the individual gun dms, so make sure you set them right. It's a pain to go back to find which guns are set incorrectly. To summarize: rail attachments should go on top of the rail. For rifles, this usually means the middle of the gun. For handguns, this is usually toward the back of the gun. SMGs usually follow rifles. Muzzle attachments should connect to the barrel, not sit under or above it. The only exception is the bayonet. Underrail attachments should just fit snugly, that's about it. Stocks are pretty obvious.
All attachment offsets are now in a list, including stocks. Guns that don't take attachments can keep the list null. ~N
Anything that isn't used as the gun fires should be a flat number, never a percentange. It screws with the calculations, and can mean that the order you attach something/detach something will matter in the final number. It's also completely inaccurate. Don't worry if force is ever negative, it won't runtime.
Vars | |
accuracy_mod | Modifier to firing accuracy, works off a multiplier. |
---|---|
accuracy_unwielded_mod | Modifier to firing accuracy but for when onehanded. |
activation_sound | The specific sound played when activating this attachment. |
add_aim_mode | adds aim mode to the gun |
aim_mode_delay_mod | Modifies aim mode fire rate debuff by a % |
aim_mode_movement_mult | Changes aim mode movement delay multiplicatively |
aim_speed_mod | Changes the slowdown amount when wielding a weapon by this value. |
ammo_mod | what ammo the gun could also fire, different lasers usually. |
attach_delay | How long in deciseconds it takes to attach a weapon with level 1 combat training. Default is 1.5 seconds. |
attach_features_flags | various yes no flags associated with attachments. See defines for these: [ATTACH_REMOVABLE] |
attach_shell_speed_mod | Changes the speed of projectiles fired |
attach_skill | Skill used to attach src to something. |
attach_skill_upper_threshold | Skill threshold where the time to attach is halved. |
attach_sound | Sound played on attach |
attachment_action_type | what ability to give the user when attached to a weapon they are holding. |
attachment_firing_delay | the delay between shots, for attachments that fire stuff |
base_icon | Replacement for initial icon that allows for the code to work with multiple variants |
burst_accuracy_mod | additive modifier to burst fire accuracy. |
burst_delay_mod | Changes burst firing delay. Cannot go below 0. |
burst_mod | Changes amount of shots in a burst |
burst_scatter_mod | Additive to burst scatter modifier from burst fire, works off a multiplier. |
charge_mod | how much charge difference it now costs to shoot. negative means more shots per mag. |
damage_falloff_mod | Modifier to damage falloff, works off a multiplier. |
damage_mod | Modifer to the damage mult, works off a multiplier. |
delay_mod | Changes firing delay. Cannot go below 0. |
detach_delay | How long in deciseconds it takes to detach a weapon with level 1 combat training. Default is 1.5 seconds. |
gun_attachment_offset_mod | lazylist of attachment slot offsets for a gun. |
gun_firemode_list_mod | what firemodes this attachment allows/adds. |
lace_deployed | only used by lace, denotes whether the lace is currently deployed |
light_mod | Adds an x-brightness flashlight to the weapon, which can be toggled on and off. |
master_gun | what gun this attachment is currently attached to, if any. |
max_scatter_mod | Maximum scatter |
max_scatter_unwielded_mod | Maximum scatter when unwielded |
melee_mod | Flat number that adjusts the amount of mêlée force the weapon this is attached to has. |
min_scatter_mod | Minimum scatter |
min_scatter_unwielded_mod | Minimum scatter when unwielded |
movement_acc_penalty_mod | Modifies accuracy/scatter penalty when firing onehanded while moving. |
pixel_shift_x | Determines the amount of pixels to move the icon state for the overlay. in the x direction |
pixel_shift_y | Determines the amount of pixels to move the icon state for the overlay. in the y direction |
recoil_mod | If positive, adds recoil, if negative, lowers it. Recoil can't go below 0. |
recoil_unwielded_mod | If positive, adds recoil, if negative, lowers it. but for onehanded firing. Recoil can't go below 0. |
scatter_decay_mod | How much scatter decays every X seconds |
scatter_decay_unwielded_mod | How much scatter decays every X seconds when wielded |
scatter_increase_mod | How much scatter increases per shot |
scatter_increase_unwielded_mod | How much scatter increases per shot when wielded |
scatter_mod | Increases or decreases scatter chance. |
scatter_unwielded_mod | Increases or decreases scatter chance but for onehanded firing. |
scope_zoom_mod | used for the codex to denote if a weapon has the ability to zoom in or not. |
scoped_accuracy_mod | Modifier to firing accuracy but for when scoped in, works off a multiplier. |
shot_marine_damage_falloff | Modifies projectile damage by a % when a marine gets passed, but not hit |
silence_mod | Adds silenced to weapon. changing its fire sound, muzzle flash, and volume. TRUE or FALSE |
size_mod | Increases the weight class. |
slot | ATTACHMENT_SLOT_MUZZLE, ATTACHMENT_SLOT_RAIL, ATTACHMENT_SLOT_UNDER, ATTACHMENT_SLOT_STOCK the particular 'slot' the attachment can attach to. must always be a singular slot. |
variants_by_parent_type | Assoc list that uses the parents type as a key. type = "new_icon_state". This will change the icon state depending on what type the parent is. If the list is empty, or the parent type is not within, it will have no effect. |
wield_delay_mod | How long ADS takes (time before firing) |
Procs | |
activate | Called when the attachment is activated. |
apply_modifiers | Handles the modifiers to the parent gun |
can_attach | Called when the attachment is trying to be attached. If the attachment is allowed to go through, return TRUE. |
on_attach | Called when the attachment is attached to something. If it is a gun it will update the guns stats. |
on_detach | Called when the attachment is detached from something. If the thing is a gun, it returns its stats to what they were before being attached. |
ui_action_click | actually gives the user aim_mode if they're holding the gun |
Var Details
accuracy_mod

Modifier to firing accuracy, works off a multiplier.
accuracy_unwielded_mod

Modifier to firing accuracy but for when onehanded.
activation_sound

The specific sound played when activating this attachment.
add_aim_mode

adds aim mode to the gun
aim_mode_delay_mod

Modifies aim mode fire rate debuff by a %
aim_mode_movement_mult

Changes aim mode movement delay multiplicatively
aim_speed_mod

Changes the slowdown amount when wielding a weapon by this value.
ammo_mod

what ammo the gun could also fire, different lasers usually.
attach_delay

How long in deciseconds it takes to attach a weapon with level 1 combat training. Default is 1.5 seconds.
attach_features_flags

various yes no flags associated with attachments. See defines for these: [ATTACH_REMOVABLE]
attach_shell_speed_mod

Changes the speed of projectiles fired
attach_skill

Skill used to attach src to something.
attach_skill_upper_threshold

Skill threshold where the time to attach is halved.
attach_sound

Sound played on attach
attachment_action_type

what ability to give the user when attached to a weapon they are holding.
attachment_firing_delay

the delay between shots, for attachments that fire stuff
base_icon

Replacement for initial icon that allows for the code to work with multiple variants
burst_accuracy_mod

additive modifier to burst fire accuracy.
burst_delay_mod

Changes burst firing delay. Cannot go below 0.
burst_mod

Changes amount of shots in a burst
burst_scatter_mod

Additive to burst scatter modifier from burst fire, works off a multiplier.
charge_mod

how much charge difference it now costs to shoot. negative means more shots per mag.
damage_falloff_mod

Modifier to damage falloff, works off a multiplier.
damage_mod

Modifer to the damage mult, works off a multiplier.
delay_mod

Changes firing delay. Cannot go below 0.
detach_delay

How long in deciseconds it takes to detach a weapon with level 1 combat training. Default is 1.5 seconds.
gun_attachment_offset_mod

lazylist of attachment slot offsets for a gun.
gun_firemode_list_mod

what firemodes this attachment allows/adds.
lace_deployed

only used by lace, denotes whether the lace is currently deployed
light_mod

Adds an x-brightness flashlight to the weapon, which can be toggled on and off.
master_gun

what gun this attachment is currently attached to, if any.
max_scatter_mod

Maximum scatter
max_scatter_unwielded_mod

Maximum scatter when unwielded
melee_mod

Flat number that adjusts the amount of mêlée force the weapon this is attached to has.
min_scatter_mod

Minimum scatter
min_scatter_unwielded_mod

Minimum scatter when unwielded
movement_acc_penalty_mod

Modifies accuracy/scatter penalty when firing onehanded while moving.
pixel_shift_x

Determines the amount of pixels to move the icon state for the overlay. in the x direction
pixel_shift_y

Determines the amount of pixels to move the icon state for the overlay. in the y direction
recoil_mod

If positive, adds recoil, if negative, lowers it. Recoil can't go below 0.
recoil_unwielded_mod

If positive, adds recoil, if negative, lowers it. but for onehanded firing. Recoil can't go below 0.
scatter_decay_mod

How much scatter decays every X seconds
scatter_decay_unwielded_mod

How much scatter decays every X seconds when wielded
scatter_increase_mod

How much scatter increases per shot
scatter_increase_unwielded_mod

How much scatter increases per shot when wielded
scatter_mod

Increases or decreases scatter chance.
scatter_unwielded_mod

Increases or decreases scatter chance but for onehanded firing.
scope_zoom_mod

used for the codex to denote if a weapon has the ability to zoom in or not.
scoped_accuracy_mod

Modifier to firing accuracy but for when scoped in, works off a multiplier.
shot_marine_damage_falloff

Modifies projectile damage by a % when a marine gets passed, but not hit
silence_mod

Adds silenced to weapon. changing its fire sound, muzzle flash, and volume. TRUE or FALSE
size_mod

Increases the weight class.
slot

ATTACHMENT_SLOT_MUZZLE, ATTACHMENT_SLOT_RAIL, ATTACHMENT_SLOT_UNDER, ATTACHMENT_SLOT_STOCK the particular 'slot' the attachment can attach to. must always be a singular slot.
variants_by_parent_type

Assoc list that uses the parents type as a key. type = "new_icon_state". This will change the icon state depending on what type the parent is. If the list is empty, or the parent type is not within, it will have no effect.
wield_delay_mod

How long ADS takes (time before firing)
Proc Details
activate
Called when the attachment is activated.
apply_modifiers
Handles the modifiers to the parent gun
can_attach
Called when the attachment is trying to be attached. If the attachment is allowed to go through, return TRUE.
on_attach
Called when the attachment is attached to something. If it is a gun it will update the guns stats.
on_detach
Called when the attachment is detached from something. If the thing is a gun, it returns its stats to what they were before being attached.
ui_action_click
actually gives the user aim_mode if they're holding the gun