diff --git a/classes/Gun.lua b/classes/Gun.lua index 566ca5b..abf4668 100644 --- a/classes/Gun.lua +++ b/classes/Gun.lua @@ -24,7 +24,7 @@ local Vec = vector -- -- *Please note:* there are likey undocumented fields that are used in internal functions. If you find one, please make an issue on Github. -- --- @class gun +-- @class Gun -- @display gun -- @compact -- @field properties @{lvl1_fields.properties|properties} which define the vast majority of gun attributes and may change accross instances diff --git a/docs/class/Gun.html b/docs/class/Gun.html index b57bfdf..fecf291 100644 --- a/docs/class/Gun.html +++ b/docs/class/Gun.html @@ -3,7 +3,7 @@
-gun
-¶
-class fields
-method documentation coming soon (or never...)
-The appearance and handling of guns by default 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, etc. -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 other fields of the class define tracking variables or other important things for the internal workings.
-There are essentially only 3 fields you must define to register a gun: itemstring, name, and properties. -To hold the gun, the item defined in itemstring must actually exist, it will not automatically register. To have a functional gun however, more will need to be changed in terms of properties. -it's reccomended that you take a look at existing mods (like guns4d_pack_1) for guidance
-Guns4d uses a class system for most moving parts- including the gun. New guns therefore 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.
-for properties: for tables where you wish to delete the parent class's fields altogether (since inheritence prevents this) you can set the field "__replace_old_table=true" -additionally
-Please note: there are likey undocumented fields that are used in internal functions. If you find one, please make an issue on Github.
-properties¶ | -properties which define the vast majority of gun attributes and may change accross instances - |
-
consts¶ | -constants which define gun attributes and should not be changed in an instance of the gun - |
-
offsets¶ | -runtime storage of offsets generated by recoil sway wag or any other element. - |
-
name¶ | -
|
-
itemstring¶ | -
|
-
itemstack¶ | -
|
-
player¶ | -
|
-
meta¶ | -
|
-
id¶ | -
|
-
gun_entity¶ | -
|
-
_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¶ | -
|
-
gun_translation¶ | -
|
-
property_modifiers¶ | -
|
-
attached_objects¶ | -
|
-
subclass_instances¶ | -
|
-
animation_rotation¶ | -
|
-
animation_translation¶ | -
|
-
total_offsets¶ | -all offsets from gun.offset of a type added together gun in the same format as a an offset (that is, five vectors, |
-
velocities¶ | -velocities in the format of offsets, but only containing angular ( |
-
the table containing every attribute of the gun.
- -hip¶ | -- | -
ads¶ | -- | -
firemodes¶ | -- | -
recoil¶ | -- | -
sway¶ | -- | -
wag¶ | -- | -
charging¶ | -- | -
ammo¶ | -- | -
visuals¶ | -- | -
sounds¶ | -- | -
inventory¶ | -- | -
initial_vertical_rotation¶ | -
|
-
breathing_scale¶ | -
|
-
flash_offset¶ | -
|
-
firerateRPM¶ | -
|
-
reload¶ | -an ordered list of reloading states used by default_controls. -the default reload states for a magazine operated weapon, copied from the m4. -Example-
- |
-
model_bounding_box¶ | -
|
-
infinite_inventory_overlay¶ | -
|
-
burst¶ | -
|
-
pc_control_actions¶ | -
|
-
touch_control_actions¶ | -
|
-
render_size¶ | -the size in meters to render the gun in it's inventory opened with /guns4d_inv - |
-
render_image¶ | -the image of the gun in it's inventory opened with /guns4d_inv - |
-
firemode_inventory_overlays¶ | -table of firemodes and their overlays in the player's inventory when the gun is on that firemode - |
-
inventory_image_magless¶ | -
|
-
inventory_image¶ | -
|
-
ammo_handler¶ | -
|
-
part_handler¶ | -
|
-
sprite_scope¶ | -
|
-
crosshair¶ | -
|
-
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 - |
-
list containing the firemodes of the gun. Default only contains "single". Strings allowed by default: -
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¶ | -
|
-
magazine_only¶ | -
|
-
accepted_bullets¶ | -
|
-
accepted_magazines¶ | -
|
-
initial_mag¶ | -
|
-
mesh¶ | -name of mesh to display. Currently only supports b3d - |
-
textures¶ | -list of textures to use. - |
-
scale¶ | -scale multiplier. Default 1 - |
-
attached_objects¶ | -objects that are attached to the gun. This is especially useful for attachments -Example-
- |
-
backface_culling¶ | -toggles backface culling. Default true - |
-
animations¶ | -a table of animations. Indexes define the name of the animation to be refrenced by other functions of the gun.
-should be in the format Example-
-There are other animations which are variable which are not listed here, these are usually defined by properties such as: -reload, draw_animation - |
-
other fields are defined by other properties such as properties.charging.draw_sound and properties.reload -
fire¶ | -sound player when firing the weapon - |
-
a list of tables each containing offset vectors These are required for automatic initialization of offsets. -note rotations are in degrees, and translations are in meters.
-recoil = {
- gun_axial = {x=0, y=0}, --rotation of the gun around it's origin.
- player_axial = {x=0, y=0}, --rotation of the gun around the bone it's attached to
- --translations of gun
- player_trans = {x=0, y=0, z=0}, --translation of the bone the gun is attached to
- eye_trans = {x=0, y=0, z=0}, --trnaslation of the player's look
- gun_tran = {x=0, y=0, z=0}s --translation of the gun relative to the bone it's attachted to.
-}
-
-
-
-These are variables that are constant across the class and should usually not ever be changed by instnaces
- -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¶ | -
|
-
VERSION¶ | -
|
-
gun
-¶
+Gun
+¶
module
- -properties | -properties which define the vast majority of gun attributes and may change accross instances - |
-
consts | -constants which define gun attributes and should not be changed in an instance of the gun - |
-
offsets | -runtime storage of offsets generated by recoil sway wag or any other element - |
-
name | -
|
-
itemstring | -
|
-
itemstack | -
|
-
player | -
|
-
meta | -
|
-
id | -
|
-
gun_entity | -
|
-
_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 | -
|
-
gun_translation | -
|
-
property_modifiers | -
|
-
attached_objects | -
|
-
subclass_instances | -
|
-
animation_rotation | -
|
-
animation_translation | -
|
-
total_offsets | -all offsets from gun.offset of a type added together gun in the same format as a an offset (that is, five vectors, |
-
velocities | -velocities in the format of offsets, but only containing angular ( |
-
properties which define the vast majority of gun attributes and may change accross instances
- -constants which define gun attributes and should not be changed in an instance of the gun
- -runtime storage of offsets generated by recoil sway wag or any other element.
- -string
the name of the gun. Set to __template for guns which have no instances and serve as a template. It is safe to set name to the same as gun.itemstring
string
the itemstring of the gun- i.e. "guns4d_pack_1:m4"
. Set to ""
for __template
guns.
ItemStack
the gun itemstack. Remember to player:set_wielded_item(self.itemstack) when making meta or itemstack changes.
ObjRef
the operator of the weapon. This may at some point be deprecated when I start to implement AI/mob usage
MetaDataRef
itemstack meta
string
the ID of the gun used for tracking of it's inventory
ObjRef
the gun entity
list of registered guns, DO NOT MODIFY I really need a metatable for this class...
- -bool
is the bolt charged
table
list of particle spawner handles (generated by firing)
int
the active index of the firemode from firemodes
float
walking time used to generate the figure 8 for wag
float
float
float
time left for the chamber to cycle (for firerates)
int
number of rounds left that need to be fired after a burst fire
function
vec3
translation of the gun relative to the "gun" bone or the player axial rotation.
table
indexed list of functions which are called when the gun's properties need to be built. This is used for things like attachments, etc.
table
a list of ObjRefs that are attached to the gun as a result of attached_objects
table
list of subclass instances (i.e. Sprite_scope)
vector
containing the rotation offset from the current frame, this will be factored into the gun's direction if {@consts.ANIMATIONS_OFFSET_AIM}=true
vector
containing the translational/positional offset from the current frame
all offsets from gun.offset of a type added together gun in the same format as a an offset (that is, five vectors, gun_axial
, player_axial
, etc.). Note that if
-offsets are changed after update, this will not be updated automatically until the next update. update_rotations() must be called to do so.
velocities in the format of offsets, but only containing angular (gun_axial
and player_axial
) offsets.
hip¶ | -+ | |||||||||||||
ads¶ | -+ | |||||||||||||
firemodes¶ | -+ | |||||||||||||
recoil¶ | -+ | |||||||||||||
sway¶ | -+ | |||||||||||||
wag¶ | -+ | |||||||||||||
charging¶ | -+ | |||||||||||||
ammo¶ | -+ | |||||||||||||
visuals¶ | -+ | |||||||||||||
sounds¶ | -+ | |||||||||||||
inventory¶ | -+ | |||||||||||||
part_handler¶ | -
|
|
|||||||||
target_correction_max_rate¶ | -
|
|
||||||
offset¶ | -
|
|
draw_animation¶ | -
|
|
draw_sound¶ | -
|
|
other fields are defined by other properties such as properties.charging.draw_sound and properties.reload -
other fields are defined by other properties such as properties.charging.draw_sound and properties.reload +