Guns4d | The ultimate 3d gun mod.

Module Gun-methods

Synopsis

Functions
gun_default:update()

The entry method for the update of the gun

gun_default:update_transforms()

updates self.total_offsets which stores offsets for bones

gun_default:update_burstfire()

Update and fire the queued weapon burst

gun_default:cycle_firemodes()

cycles to the next firemode of the weapon

gun_default:update_image_and_text_meta()

update the inventory information of the gun

gun_default:draw()

plays the draw animation and sound for the gun, delays usage

gun_default:attempt_fire()

attempt to fire the gun

gun_default:recoil()

simulate recoil by adding to the recoil velocity (called by attempt_fire)

gun_default:update_look_offsets()

update the offsets of the player's look created by the gun

gun_default:get_pos()

get the global position of the gun

gun_default:add_entity()

adds the gun entity

gun_default:update_entity()

updates the gun's entity

gun_default:has_entity()

checks if the gun entity exists

gun_default:update_wag()

updates the gun's wag offset for walking

gun_default:update_recoil()

updates the gun's recoil simulation

gun_default:update_animation()

updates the gun's animation data

gun_default:set_animation()

sets the gun's animation in the same format as ObjRef:set_animation() (future deprecation?)

gun_default:clear_animation()

clears the animation to the rest state

gun_default:play_sounds()

plays a list of sounds for the gun's user and thirdpersons

gun_default:update(dt)

The entry method for the update of the gun

calls virtually all functions that begin with update once. Also updates subclass

Parameters
dt (float)
gun_default:update_transforms()

updates self.total_offsets which stores offsets for bones

gun_default:update_burstfire()

Update and fire the queued weapon burst

gun_default:cycle_firemodes()

cycles to the next firemode of the weapon

gun_default:update_image_and_text_meta(meta)

update the inventory information of the gun

gun_default:draw()

plays the draw animation and sound for the gun, delays usage.

gun_default:attempt_fire()

attempt to fire the gun

gun_default:recoil()

simulate recoil by adding to the recoil velocity (called by attempt_fire)

gun_default:update_look_offsets(dt)

update the offsets of the player's look created by the gun

gun_default:get_pos(offset, relative_y, relative_x, with_animation)

get the global position of the gun. This is customized to rely on the assumption that there are 3-4 main rotations and 2-3 translations. If the behavior of the bones are changed this method may not work

Parameters
offset ()
relative_y (bool)

wether the y axis is relative to the player's look

relative_x (bool)

wether the x axis is relative to the player's look

with_animation ()
Return Values
(vec3)

position of gun (in global or local orientation) relative to the player's position

gun_default:add_entity()

adds the gun entity

gun_default:update_entity()

updates the gun's entity

gun_default:has_entity()

checks if the gun entity exists...

Return Values
(bool)
gun_default:update_wag(dt)

updates the gun's wag offset for walking

Parameters
dt (float)
gun_default:update_recoil(dt)

updates the gun's recoil simulation

Parameters
dt (float)
gun_default:update_animation(dt)

updates the gun's animation data

gun_default:set_animation(frames, length, fps, loop)

sets the gun's animation in the same format as ObjRef:set_animation() (future deprecation?)

Parameters
frames (table)

{x=int, y=int}

length (float or nil)

length of the animation in seconds

fps (int)

frames per second of the animation

loop (bool)

wether to loop

gun_default:clear_animation()

clears the animation to the rest state

gun_default:play_sounds(sound)

plays a list of sounds for the gun's user and thirdpersons

Parameters
sound (soundspec_list)

parameters following the format of Guns4d.play_sounds()

Return Values
1. (integer)

thirdperson sound's guns4d sound handle

2. (integer)

firstperson sound's guns4d sound handle