Gun-methods
¶
gun_default:update() | The entry method for the update of the gun |
gun_default:regenerate_visuals() | not typically called every step, updates the gun object's visuals |
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:muzzle_flash() | plays the muzzle flash animation |
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:prepare_deletion() | ready the gun to be deleted |
The entry method for the update of the gun
calls virtually all functions that begin with update
once. Also updates subclass
dt | (float) |
not typically called every step, updates the gun object's visuals
updates self.total_offsets which stores offsets for bones
Update and fire the queued weapon burst
cycles to the next firemode of the weapon
update the inventory information of the gun
plays the draw animation and sound for the gun, delays usage.
plays the muzzle flash animation
attempt to fire the gun
simulate recoil by adding to the recoil velocity (called by attempt_fire)
update the offsets of the player's look created by the gun
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. the point of this is to allow the user to find the gun's object origin as well as calculate where a given point should be offset given the parameters.
offset | () | |
relative_y | (bool) | wether the y axis player look rotation is set to 0 |
relative_x | (bool) | wether the x axis player look rotation is set to 0 |
with_animation | (bool) | wether rotational and translational offsets from the animation are applied or 0 |
(vec3) | position of gun (in global or local orientation) relative to the player's position |
adds the gun entity
updates the gun's entity
checks if the gun entity exists...
(bool) |
updates the gun's wag offset for walking
dt | (float) |
updates the gun's recoil simulation
dt | (float) |
updates the gun's animation data
sets the gun's animation in the same format as ObjRef:set_animation() (future deprecation?)
frames | (table) |
|
length | (float or nil) | length of the animation in seconds |
fps | (int) | frames per second of the animation |
loop | (bool) | wether to loop |
clears the animation to the rest state
plays a list of sounds for the gun's user and thirdpersons
sound | (soundspec_list) | parameters following the format of Guns4d.play_sounds() |
1. | (integer) | thirdperson sound's guns4d sound handle |
2. | (integer) | firstperson sound's guns4d sound handle |
ready the gun to be deleted