Gun
¶
Gun class
method documentation coming soon (or never...)
guns are defined by two table fields: their consts and their properties. properties define nearly everything, from how a gun handles to how it looks, what model it uses, while consts define attributes that should never change, like bones within the gun, framerates, wether the gun is allowed to have certain attributes at all. The rest is mainly for internal workings of the mod.
Guns4d uses a class system for most moving parts- including the gun. New guns therefor are created with the :inherit(def) method, where def is the definition of your new gun- or rather the changed parts of it. So to make a new gun you can run Guns4d.gun:inherit() or you can do the same thing with a seperate class of weapons. Set name to "__template" for template classes of guns.
properties¶ | properties which define the vast majority of gun attributes and may change accross instances |
consts¶ | constancts which define gun attributes and should not be changed in an instance of the gun |
offsets¶ | offsets. runtime storage of offsets generated by recoil sway wag or any other element. |
name¶ |
|
itemstack¶ |
|
gun_entity¶ |
|
itemstring¶ |
|
_registered¶ | list of registered guns, DO NOT MODIFY I really need a metatable for this class... |
bolt_charged¶ |
|
particle_spawners¶ |
|
current_firemode¶ |
|
walking_tick¶ |
|
time_since_last_fire¶ |
|
time_since_creation¶ |
|
rechamber_time¶ |
|
burst_queue¶ |
|
muzzle_flash¶ |
|
animation_rotation¶ |
|
total_offset_rotation¶ | total offsets of the gun in the same format as a an offset |
the table containing every attribute of the gun.
hip¶ | |
ads¶ | |
firemodes¶ | |
firemode_inventory_overlays¶ | |
recoil¶ | |
sway¶ | |
wag¶ | |
charging¶ | |
ammo¶ | |
visuals¶ | |
breathing_scale¶ |
|
flash_offset¶ |
|
firerateRPM¶ |
|
item¶ | the item entity's attributes. This will later include held item definition... |
burst¶ |
|
infinite_inventory_overlay¶ |
|
pc_control_actions¶ |
|
touch_control_actions¶ |
|
reload¶ | and ordered list of reloading states used by default_controls. the default reload states for a magazine operated weapon, copied from the m4. Example
|
sounds¶ | a table of soundspecs to be referenced by other functions |
offset¶ |
|
axis_rotation_ratio¶ | the ratio that the look rotation is expressed through player_axial (rotated around the viewport) rotation as opposed to gun_axial (rotating the entity). |
sway_vel_mul¶ | sway speed multiplier while at hip |
sway_angle_mul¶ | sway angle multiplier while at hip+ |
defines the overlay on the gun item for each firemode. These are selected automatically by firemode string. Defaults are as follows:
IMPORTANT: expects fields to be tables containing a "gun_axial" and "player_axial" field.
property = {
gun_axial = type
player_axial = type
}
--using a vector...
property = {
gun_axial={x=float, y=float},
player_axial={x=float, y=float}
}`
velocity_correction_factor¶ |
|
target_correction_factor¶ |
|
target_correction_max_rate¶ |
|
angular_velocity_max¶ |
|
angular_velocity¶ |
|
bias¶ |
|
hipfire_multiplier¶ |
|
IMPORTANT: expects fields to be tables containing a "gun_axial" and "player_axial" field. In the same format as gun.properties.recoil
cycle_speed¶ |
|
decay_speed¶ |
|
offset¶ |
|
require_draw_on_swap¶ |
|
bolt_charge_mode¶ |
|
draw_time¶ |
|
draw_animation¶ |
|
draw_sound¶ |
|
These are variables that are constant across the class and should usually not ever be changed by instnaces
AIM_OUT_AIM_IN_SPEED_RATIO¶ | |
KEYFRAME_SAMPLE_PRECISION¶ | frequency of keyframe samples for animation offsets and |
DEFAULT_MAX_HEAR_DISTANCE¶ | default max hear distance when not specified |
DEFAULT_FPS¶ |
|
HAS_RECOIL¶ |
|
HAS_BREATHING¶ |
|
HAS_SWAY¶ |
|
HAS_WAG¶ |
|
HAS_GUN_AXIAL_OFFSETS¶ |
|
ANIMATIONS_OFFSET_AIM¶ | wether animations create an offset |
LOOP_IDLE_ANIM¶ | whether the idle animation changes or not |
THIRD_PERSON_GAIN_MULTIPLIER¶ | general gain multiplier for third persons when hearing sounds |
ROOT_BONE¶ | the root bone of the gun (for animation offsets) |
MAG_BONE¶ |
|
ARM_RIGHT_BONE¶ |
|
ARM_LEFT_BONE¶ |
|