major recoil changes (wrong branch...), documented properties

This commit is contained in:
FatalErr42O 2024-06-25 14:53:16 -07:00
parent 9d3f1ea12f
commit 8279359aad
47 changed files with 3004 additions and 1858 deletions

View File

@ -205,7 +205,7 @@ function Guns4d.ammo.magazine(magname)
end
function Guns4d.ammo.magazine_of_gun(gunname, full, string)
local gprops = Guns4d.gun.registered[gunname].properties
local gprops = Guns4d.gun._registered[gunname].properties
local magname = gprops.ammo.accepted_magazines[1]
assert(magname, "magazines are not accepted")
local mag = ItemStack(magname)

View File

@ -28,8 +28,10 @@ Ammo_handler = Instantiatable_class:inherit({
meta:set_int("guns4d_spawn_with_ammo", 0)
def:update_meta()
else
--create or reinitialize ammo data
if meta:get_string("guns4d_loaded_bullets") == "" then
def.ammo.loaded_mag = gun.properties.ammo.initial_mag or "empty"
local ammo_props = gun.properties.ammo
def.ammo.loaded_mag = ammo_props.initial_mag or (ammo_props.accepted_magazines and ammo_props.accepted_magazines[1]) or "empty"
def.ammo.next_bullet = "empty"
def.ammo.total_bullets = 0
def.ammo.loaded_bullets = {}

View File

@ -1,119 +1,238 @@
--- Gun class
-- @classmod Gun
--
-- ## Defining a gun:
--
-- **method documentation coming soon** (or never...)
--
-- guns are defined by two table fields: their @{lvl1_fields.consts|consts} and their @{lvl1_fields.properties|properties}.
-- @{lvl1_fields.properties|properties} define nearly everything, from how a gun handles to how it looks, what model it uses,
-- while @{lvl1_fields.consts|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.
--
-- @class Gun
-- @compact
local Vec = vector
local gun_default = {
--itemstack = Itemstack
--gun_entity = ObjRef
name = "__guns4d:default__",
itemstring = "",
registered = {},
property_modifiers = {},
--ldoc will fuck this up, so fields are handled by external post-generation script.
--- gun fields
--
-- @table gun
-- @field properties @{lvl1_fields.properties|properties} which define the vast majority of gun attributes and may change accross instances
-- @field consts @{lvl1_fields.consts|constancts} which define gun attributes and should not be changed in an instance of the gun
-- @field offsets @{lvl1_fields.offsets|properties} runtime storage of offsets generated by recoil sway wag or any other element.
-- @compact
local gun_default = {
--- `string` the name of the gun. Set to __template for guns which have no instances.
name = "__guns4d:default__",
--- `ItemStack` itemstack held by the player
itemstack = nil,
--- `ObjRef` the gun entity
gun_entity = nil,
--- `string` the itemstring of the gun- i.e. "guns4d_pack_1:m4". Set to "" for __template guns.
itemstring = "",
--- list of registered guns, **DO NOT MODIFY** I really need a metatable for this class...
_registered = {},
--- `bool` is the bolt charged
bolt_charged = false,
--- `table` list of particle spawner handles (generated by firing)
particle_spawners = {},
--- `int` the active index of the firemode from @{lvl1_fields.properties.firemodes}
current_firemode = 1,
--- `float` walking time used to generate the figure 8 for wag
walking_tick = 0,
--- `float`
time_since_last_fire = 0,
--- `float`
time_since_creation = 0,
--- `float` time left for the chamber to cycle (for firerates)
rechamber_time = 0,
--- `int` number of rounds left that need to be fired after a burst fire
burst_queue = 0,
--- `function`
muzzle_flash = Guns4d.effects.muzzle_flash,
--- properties
--
-- the table containing every attribute of the gun.
-- @table properties
-- @table lvl1_fields.properties
-- @field hip `table` @{gun.properties.hip|hipfire properties}
-- @field ads `table` @{gun.properties.ads|aiming ("aiming down sights") properties}
-- @field firemodes `table` @{gun.properties.firemodes|list of firemodes}
-- @field firemode_inventory_overlays `table` @{gun.properties.firemode_inventory_overlays|list of corresponding images for firemodes}
-- @field recoil `table` @{gun.properties.recoil|defines the guns recoil}
-- @field sway `table` @{gun.properties.sway|defines the guns idle sway}
-- @field wag `table` @{gun.properties.wag|defines the movement of the gun while walking}
-- @field charging `table` @{gun.properties.charging|defines how rounds are chambered into the gun}
-- @field ammo @{gun.properties.ammo|defines what ammo the gun uses}
-- @field visuals @{gun.properties.visuals|defines visual attributes of the gun}
-- @compact
properties = {
--%start "properties"
infinite_inventory_overlay = "inventory_overlay_inf_ammo.png",
breathing_scale = .5, --the max angluler offset caused by breathing.
flash_offset = Vec.new(), --used by fire() (for fsx and ray start pos) [RENAME NEEDED]
firerateRPM = 600, --used by update() and by extent fire() + default controls. The firerate of the gun. Rounds per minute
burst = 3, --how many rounds in burst using when firemode is at "burst"
ammo_handler = Ammo_handler,
--- `float`=.5 max angular deviation (vertical) from breathing
breathing_scale = .5,
--- `vector` the offset from the center of the muzzle flash. Used by fire()
flash_offset = Vec.new(),
--- `int`=600 The number of rounds (cartidges) this gun can throw per minute. Used by update(), fire() and default controls
firerateRPM = 600,
--- the item entity's attributes. This will later include held item definition...
item = {
collisionbox = ((not Guns4d.config.realistic_items) and {-.1,-.1,-.1, .1,.1,.1}) or {-.1,-.05,-.1, .1,.15,.1},
selectionbox = {-.1,-.1,-.1, .1,.1,.1}
},
hip = {
--- properties.hip
-- @table gun.properties.hip
-- @compact
hip = {--#1
--- `vector` the offset of the gun (relative to the right arm's default position) at hip.
offset = Vec.new(),
--- the ratio that the look rotation is expressed through player_axial (rotated around the viewport) rotation as opposed to gun_axial (rotating the entity).
axis_rotation_ratio = .75,
--- sway speed multiplier while at hip
sway_vel_mul = 5,
--- sway angle multiplier while at hip+
sway_angle_mul = 1,
},
ads = { --used by player_handler, animation handler (eye bone offset from horizontal_offset), gun entity (attached offset)
--- properties.ads
-- @table gun.properties.ads
-- @compact
ads = { --#2
--- `vector` the offset of the gun relative to the eye's position at hip.
offset = Vec.new(),
--- `float` the horizontal offset of the eye when aiming
horizontal_offset = 0,
--- the time it takes to go into full aim
aim_time = 1,
},
firemodes = {
--- `int`=3 how many rounds in burst using when firemode is at "burst"
burst = 3,
--- properties.firemodes
--
-- list containing the firemodes of the gun. Default only contains "single". Strings allowed by default:
-- @table gun.properties.firemodes
-- @compact
-- @field "single"
-- @field "burst"
-- @field "auto"
firemodes = { --#3
"single", --not limited to semi-automatic.
--"burst",
--"auto"
},
firemode_inventory_overlays = {
--- `string` overlay on the item to use when infinite ammo is on
infinite_inventory_overlay = "inventory_overlay_inf_ammo.png",
--- properties.firemode_inventory_overlays
--
-- defines the overlay on the gun item for each firemode. These are selected automatically by firemode string. Defaults are as follows:
-- @table gun.properties.firemode_inventory_overlays
-- @compact
firemode_inventory_overlays = { --#4
--- "inventory_overlay_single.png"
single = "inventory_overlay_single.png",
--- "inventory_overlay_auto.png"
auto = "inventory_overlay_auto.png",
--- "inventory_overlay_burst.png"
burst = "inventory_overlay_burst.png",
--- "inventory_overlay_safe.png" (unimplemented firemode)
safe = "inventory_overlay_safe.png"
},
--[[bloom = { not yet implemented.
base_aiming = 0, --amount of bloom at a full rest while aiming down sights (if possible)
base_hip = 0, --amount of bloom at rest while not aiming down sights.
recoil = {
decay = 1, --decay rate
amount = 0,
ratio = 0, --ratio of x to y
},
walking = {
decay = 1,
amount = 0,
ratio = 0,
}
},]]
recoil = { --used by update_recoil()
--- properties.recoil
--
-- **IMPORTANT**: expects fields to be tables containing a "gun_axial" and "player_axial" field.
-- @example
-- property = {
-- gun_axial = type
-- player_axial = type
-- }
-- --using a vector...
-- property = {
-- gun_axial={x=float, y=float},
-- player_axial={x=float, y=float}
-- }`
-- @table gun.properties.recoil
-- @compact
recoil = { --#5 used by update_recoil()
--- `float` TL:DR higher decreases recoil at expense of smoothness. 1/value is the deviation of a normalized bell curve, where x is the time since firing.
-- this means that increasing it decreases the time it takes for the angular velocity to fully "decay".
velocity_correction_factor = { --velocity correction factor is currently very broken.
gun_axial = 1,
player_axial = 1,
},
--- `float` Correction of recoil offset per second is calculated as such: `target_correction_factor[axis]*time_since_fire*recoil[axis]`
target_correction_factor = { --angular correction rate per second: time_since_fire*target_correction_factor
gun_axial = 1,
player_axial = 1,
},
angular_velocity_max = { --max velocity, so your gun doesnt "spin me right round baby round round"
gun_axial = 1,
player_axial = 1,
--- `float` The maximum rate per second of recoil offset as determined with @{target_correction_factor}
target_correction_max_rate = { --the cap for target_correction_fire (i.e. this is the maximum amount it will ever correct per second.)
gun_axial = math.huge,
player_axial = math.huge,
},
--- `float` caps the recoil velocity that can stack up from shots.
angular_velocity_max = { --max velocity, so your gun doesnt "spin me right round baby round round"
gun_axial = 5,
player_axial = 5,
},
--- `vector` {x=`float`, y=`float`}, defines the initial angular velocity produced by firing the gun
angular_velocity = { --the velocity added per shot. This is the real "recoil" part of the recoil
gun_axial = {x=0, y=0},
player_axial = {x=0, y=0},
},
--- `vector` {x=`float`, y=`float`}, ranges -1 to 1. Defines the probability of the recoil being positive or negative for any given axis.
bias = { --dictates the distribution bias for the direction angular_velocity is in. I.e. if you want recoil to always go up you set x to 1, more often to the right? y to -.5
gun_axial = {x=1, y=0},
player_axial = {x=1, y=0},
},
target_correction_max_rate = { --the cap for target_correction_fire (i.e. this is the maximum amount it will ever correct per second.)
gun_axial = 1,
player_axial = 1,
},
--- `float` angular velocity multiplier when firing from the hip
hipfire_multiplier = { --the mutliplier for recoil (angular_velocity) at hipfire (can be fractional)
gun_axial = 1,
player_axial = 1
},
},
sway = { --used by update_sway()
--- properties.sway
--
-- **IMPORTANT**: expects fields to be tables containing a "gun_axial" and "player_axial" field. In the same format as @{gun.properties.recoil}
-- @table gun.properties.sway
-- @compact
sway = { --#6
--- `float` maximum angle of the sway
max_angle = {
gun_axial = 0,
player_axial = 0,
},
--- `float` angular velocity the sway
angular_velocity = {
gun_axial = 0,
player_axial = 0,
},
--- `float` maximum angle multiplier while the gun is at the hip
hipfire_angle_multiplier = { --the mutliplier for sway max_angle at hipfire (can be fractional)
gun_axial = 2,
player_axial = 2
},
--- `float` velocity multiplier while the gun is at the hip
hipfire_velocity_multiplier = { --same as above but for velocity.
gun_axial = 2,
player_axial = 2
}
},
walking_offset = { --used by update_walking() (or something)
gun_axial = {x=1, y=-1},
player_axial = {x=1,y=1},
--- properties.wag
--
-- @table gun.properties.wag
-- @compact
wag = {
--- `float`=1.6 the cycle speed multiplier
cycle_speed = 1.6,
--- `float`=1 decay factor when walking has stopped and offset remains.
decay_speed = 1,
--- `table` containing angular deviation while walking in the same format as @{gun.properties.recoil|an offset vector}. Acts as a multiplier on the figure-8 generated while walking.
offset = { --used by update_walking() (or something)
gun_axial = {x=1, y=-1},
player_axial = {x=1,y=1},
},
},
--- `table` containing a list of actions for PC users passed to @{Control_handler}
pc_control_actions = { --used by control_handler
__overfill=true, --this table will not be filled in.
aim = Guns4d.default_controls.aim,
@ -122,6 +241,7 @@ local gun_default = {
on_use = Guns4d.default_controls.on_use,
firemode = Guns4d.default_controls.firemode
},
--- `table` containing a list of actions for touch screen users passed to @{Control_handler}
touch_control_actions = {
__overfill=true,
aim = Guns4d.default_touch_controls.aim,
@ -130,53 +250,64 @@ local gun_default = {
on_secondary_use = Guns4d.default_touch_controls.on_secondary_use,
firemode = Guns4d.default_touch_controls.firemode
},
charging = { --how the gun "cocks"
--- properties.charging
--
-- @table gun.properties.charging
-- @compact
charging = { --#7
--- `bool` defines wether the draw animation is played on swap (when loaded). Used in the instance construction method
require_draw_on_swap = true,
--- `string` "none" bolt will never need to be charged after reload, "catch" when fired to empty bolt will not need to be charged after reload, "no_catch" bolt will always need to be charged after reload.
bolt_charge_mode = "none", --"none"-chamber is always full, "catch"-when fired to dry bolt will not need to be charged after reload, "no_catch" bolt will always need to be charged after reload.
--- `float` the time it takes to swap to the gun
draw_time = 1,
--- `string` name of the animation to play from @{gun.properties.visuals.animations|visuals.animations}
draw_animation = "draw",
--- `string` name of the sound to play from @{gun.properties.sounds|sounds}
draw_sound = "draw"
--sound = soundspec
},
reload = { --used by defualt controls. Still provides usefulness elsewhere.
--- and ordered list of reloading states used by @{default_controls}.
--
-- the default reload states for a magazine operated weapon, copied from the m4.
-- @example
-- {action="charge", time=.5, anim="charge", sounds={sound="ar_charge", delay = .2}},
-- {action="unload_mag", time=.25, anim="unload", sounds = {sound="ar_mag_unload"}},
-- {action="store", time=.5, anim="store", sounds = {sound="ar_mag_store"}},
-- {action="load", time=.5, anim="load", sounds = {sound="ar_mag_load", delay = .25}},
-- {action="charge", time=.5, anim="charge", sounds={sound="ar_charge", delay = .2}}
reload = {
__overfill=true,
--{type="unload_mag", time=1, anim="unload_mag", interupt="to_ground", hold = true, sound = {sound = "load magazine", pitch = {min=.9, max=1.1}}},
--{type="load", time=1, anim="load"}
},
ammo = { --used by ammo_handler
--- properties.ammo
--
-- @table gun.properties.ammo
-- @compact
ammo = { --#8
magazine_only = false,
--capacity = 0, --this is only needed if magazine_only = false
--- `table` a list of accepted bullet itemstrings
accepted_bullets = {},
--- `table` a list of accepted magazine itemstrings
accepted_magazines = {},
initial_mag = "empty"
--- `string` the mag the gun starts with. Set to "empty" for no mag, otherwise it defaults to accepted_magazines[1] (if present)
initial_mag = nil
},
--- properties.visuals
--
-- @table gun.properties.visuals
-- @compact
visuals = {
--textures = {},
--mesh="string.b3d",
--- toggles backface culling
backface_culling = true,
root = "gun",
magazine = "magazine",
arm_right = "right_aimpoint",
arm_left = "left_aimpoint",
--- a table of animations in the format {x=int, y=float}. Indexes define the name of the animation to be refrenced by other functions of the gun.
animations = { --used by animations handler for idle, and default controls
empty = {x=0,y=0},
loaded = {x=1,y=1},
},
},
--- a table of @{guns4d_soundspec|soundspecs} to be referenced by other functions
sounds = { --this does not contain reload sound effects.
release_bolt = {
__overfill=true,
sound = "ar_release_bolt",
max_hear_distance = 5,
pitch = {
min = .95,
max = 1.05
},
gain = {
min = .9,
max = 1
}
},
fire = {
{
__overfill=true,
@ -207,49 +338,55 @@ local gun_default = {
}
},
},
--[[
ammo = {
accepted_magazines = {},
accepted_bullets = {},
magazine_only = false
}
]]
ammo_handler = Ammo_handler,
sprite_scope = nil,
crosshair = nil,
initial_vertical_rotation = -60,
--inventory_image
--inventory_image_empty
--used by ammo_handler
},
--- offsets
--
-- a list of tables each containing two vectors, a gun_axial offset and a player_axial offset. These are required for automatic initialization of offsets.
-- @example
-- recoil = {
-- gun_axial = {x=0, y=0}
-- player_axial = {x=0, y=0}
-- }
-- @table lvl1_fields.offsets
-- @compact
offsets = {
---
recoil = {
gun_axial = Vec.new(),
player_axial = Vec.new(),
--move_dynamic_crosshair = false, this would make the dynamic crosshair move instead of get larger
},
---
sway = {
gun_axial = Vec.new(),
player_axial = Vec.new(),
},
---
walking = {
gun_axial = Vec.new(),
player_axial = Vec.new(),
tick = 0,
--velocity
},
---
breathing = {
gun_axial = Vec.new(), --gun axial unimplemented...
player_axial = Vec.new(),
},
---
look_snap = {
gun_axial = Vec.new(),
player_axial = Vec.new() --unimplemented
player_axial = Vec.new()
},
},
--[[spread = {
recoil = vector.new(),
walking = vector.new()
},]]
--- `vector` containing the offset from animations, this will be generated if {@consts.ANIMATIONS_OFFSET_AIM}=true
animation_rotation = vector.new(),
--- total offsets of the gun in the same format as a @{offsets|an offset}
total_offset_rotation = nil,
--[[total_offset_rotation = { --can't be in offsets, as they're added automatically.
gun_axial = Vec.new(),
player_axial = Vec.new(),
@ -260,52 +397,67 @@ local gun_default = {
gun_axial = Vec.new(),
player_axial = Vec.new(),
},
init_recoil = {
gun_axial = Vec.new(),
player_axial = Vec.new(),
},
sway = {
gun_axial = Vec.new(),
player_axial = Vec.new(),
},
},
--magic number BEGONE. these are variables that are constant across the class, but are at times too specific to be config settings (generally), or otherwise must be overriden.
--- consts
--
-- These are variables that are constant across the class and should usually not ever be changed by instnaces
-- @table lvl1_fields.consts
-- @compact
consts = {
HIP_ROTATION_RATIO = .75,
---
AIM_OUT_AIM_IN_SPEED_RATIO = 2.5,
KEYFRAME_SAMPLE_PRECISION = .1, --[[what frequency to take precalcualted keyframe samples. The lower this is the higher the memory allocation it will need- though minimal.
This will fuck shit up if you change it after gun construction/inheritence (interpolation between precalculated vectors will not work right)]]
WAG_CYCLE_SPEED = 1.6,
--- frequency of keyframe samples for animation offsets and
KEYFRAME_SAMPLE_PRECISION = .1,
--- default max hear distance when not specified
DEFAULT_MAX_HEAR_DISTANCE = 10,
--- `fps`=60 animation fps i.e. during firing when no length is specified
DEFAULT_FPS = 60,
WAG_DECAY = 1, --divisions per second
--- `bool`
HAS_RECOIL = true,
--- `bool`
HAS_BREATHING = true,
--- `bool`
HAS_SWAY = true,
--- `bool`
HAS_WAG = true,
--- `bool` wether the gun rotates on it's own axis instead of the player's view (i.e. ironsight misalignments)
HAS_GUN_AXIAL_OFFSETS = true,
--- wether animations create an offset
ANIMATIONS_OFFSET_AIM = false,
--- whether the idle animation changes or not
LOOP_IDLE_ANIM = false,
--- general gain multiplier for third persons when hearing sounds
THIRD_PERSON_GAIN_MULTIPLIER = Guns4d.config.third_person_gain_multiplier,
--ITEM_COLLISIONBOX = ((not Guns4d.config.realistic_items) and {-.1,-.1,-.1, .1,.1,.1}) or {-.1,-.05,-.1, .1,.15,.1},
--ITEM_SELECTIONBOX = {-.2,-.2,-.2, .2,.2,.2},
--- the root bone of the gun (for animation offsets)
ROOT_BONE = "gun",
--- `string`="magazine",the bone of the magazine in the gun (for dropping mags)
MAG_BONE = "magazine",
--- `string`="right_aimpoint", the bone which the right arm aims at to
ARM_RIGHT_BONE = "right_aimpoint",
--- `string`="left_aimpoint", the bone which the left arm aims at to
ARM_LEFT_BONE = "left_aimpoint",
},
--[[animation_data = { --where animations data is stored.
anim_runtime = 0,
length = 0,
fps = 0,
frames = {0,0},
current_frame = 0,
--[[animations = {
}
},]]
bolt_charged = false,
particle_spawners = {},
current_firemode = 1,
walking_tick = 0,
time_since_last_fire = 0,
time_since_creation = 0,
rechamber_time = 0,
burst_queue = 0,
muzzle_flash = Guns4d.effects.muzzle_flash
}
--I dont remember why I made this, used it though lmao
function gun_default.multiplier_coefficient(multiplier, ratio)
return 1+((multiplier*ratio)-ratio)
@ -430,36 +582,45 @@ function gun_default:attempt_fire()
if spent_bullet and spent_bullet ~= "empty" then
local dir = self.dir
local pos = self.pos
local props = self.properties
if not Guns4d.ammo.registered_bullets[spent_bullet] then
minetest.log("error", "unregistered bullet itemstring"..tostring(spent_bullet)..", could not fire gun (player:"..self.player:get_player_name()..")");
return false
end
--begin subtasks
local bullet_def = Guns4d.table.fill(Guns4d.ammo.registered_bullets[spent_bullet], {
player = self.player,
--we don't want it to be doing fuckshit and letting players shoot through walls.
pos = pos-((self.handler.control_handler.ads and dir*self.properties.ads.offset.z) or dir*self.properties.hip.offset.z),
pos = pos-((self.handler.control_handler.ads and dir*props.ads.offset.z) or dir*props.hip.offset.z),
--dir = dir, this is now collected directly by calling get_dir so pellets and spread can be handled by the bullet_ray instance.
gun = self
})
Guns4d.bullet_ray:new(bullet_def)
if self.properties.visuals.animations.fire then
self:set_animation(self.properties.visuals.animations.fire, nil, false)
if props.visuals.animations.fire then
self:set_animation(props.visuals.animations.fire, nil, false)
end
self:recoil()
self:muzzle_flash()
--[[if props.durability.shot_per_wear then
self:damage()
end]]
--print(dump(self.properties.sounds.fire))
local fire_sound = Guns4d.table.deep_copy(self.properties.sounds.fire) --important that we copy because play_sounds modifies it.
local fire_sound = Guns4d.table.deep_copy(props.sounds.fire) --important that we copy because play_sounds modifies it.
fire_sound.pos = self.pos
self:play_sounds(fire_sound)
self.rechamber_time = 60/self.properties.firerateRPM
self.rechamber_time = 60/props.firerateRPM
return true
end
end
end
--[[function gun_default:damage()
assert(self.instance, "attempt to call object method on a class")
self.itemstack:set_wear(self.itemstack:get_wear()-self.properties.durability.shot_per_wear)
self.player:set_wielded_item(self.itemstack)
end]]
local function rand_sign(b)
b = b or .5
local int = 1
@ -474,6 +635,14 @@ function gun_default:recoil()
recoil[i] = recoil[i] + (rprops.angular_velocity[axis][i]
*rand_sign((rprops.bias[axis][i]/2)+.5))
*self.multiplier_coefficient(rprops.hipfire_multiplier[axis], 1-self.handler.ads_location)
--set original velocity
self.velocities.init_recoil[axis][i] = recoil[i]
end
local length = math.sqrt(recoil.x^2+recoil.y^2)
if length > rprops.angular_velocity_max[axis] then
local co = rprops.angular_velocity_max[axis]*length
recoil.x = recoil.x*co
recoil.y = recoil.y*co
end
end
self.time_since_last_fire = 0
@ -498,8 +667,8 @@ function gun_default:update_look_rotation(dt)
local gun_axial = self.offsets.look_snap.gun_axial
local offset = handler.look_rotation.x-player_rot.x
gun_axial.x = Guns4d.math.clamp(offset, 0, 15*(offset/math.abs(offset)))
gun_axial.x = gun_axial.x+(pitch*(1-self.consts.HIP_ROTATION_RATIO))
self.offsets.look_snap.player_axial.x = -pitch*(1-self.consts.HIP_ROTATION_RATIO)
gun_axial.x = gun_axial.x+(pitch*(1-self.properties.hip.axis_rotation_ratio))
self.offsets.look_snap.player_axial.x = -pitch*(1-self.properties.hip.axis_rotation_ratio)
else
self.offsets.look_snap.gun_axial.x = 0
self.offsets.look_snap.player_axial.x = 0
@ -668,6 +837,7 @@ function gun_default:update_wag(dt)
local handler = self.handler
local wag = self.offsets.walking
local velocity = wag.velocity
local props = self.properties
local old_tick
if handler.walking then
velocity = self.player:get_velocity()
@ -682,7 +852,7 @@ function gun_default:update_wag(dt)
end
end
local walking_offset = self.offsets.walking
if velocity and (not handler.walking) and (math.ceil(old_tick/self.consts.WAG_CYCLE_SPEED)+.5 < (math.ceil(wag.tick/self.consts.WAG_CYCLE_SPEED))+.5) and (wag.tick > old_tick) then
if velocity and (not handler.walking) and (math.ceil(old_tick/props.wag.cycle_speed)+.5 < (math.ceil(wag.tick/props.wag.cycle_speed))+.5) and (wag.tick > old_tick) then
wag.velocity = nil
return
end
@ -694,13 +864,13 @@ function gun_default:update_wag(dt)
multiplier = 2
end
--if the result is negative we know that it's flipped, and thus can be ended.
local inp = (wag.tick/self.consts.WAG_CYCLE_SPEED)*math.pi*multiplier
local inp = (wag.tick/props.wag.cycle_speed)*math.pi*multiplier
--this is a mess, I think that 1.6 is the frequency of human steps or something
walking_offset[axis][i] = math.sin(inp)*self.properties.walking_offset[axis][i]
walking_offset[axis][i] = math.sin(inp)*self.properties.wag.offset[axis][i]
else
local old_value = walking_offset[axis][i]
if math.abs(walking_offset[axis][i]) > .005 then
local multiplier = 1/self.consts.WAG_DECAY
local multiplier = 1/props.wag.decay_speed
walking_offset[axis][i] = walking_offset[axis][i]-(walking_offset[axis][i]*multiplier*dt)
else
walking_offset[axis][i] = 0
@ -712,6 +882,7 @@ function gun_default:update_wag(dt)
end
end
end
local e = 2.7182818284590452353602874713527 --I don't know how to find it otherwise...
function gun_default:update_recoil(dt)
for axis, _ in pairs(self.offsets.recoil) do
for _, i in pairs({"x","y"}) do
@ -719,33 +890,35 @@ function gun_default:update_recoil(dt)
local recoil_vel = Guns4d.math.clamp(self.velocities.recoil[axis][i],-self.properties.recoil.angular_velocity_max[axis],self.properties.recoil.angular_velocity_max[axis])
local old_recoil_vel = recoil_vel
recoil = recoil + recoil_vel
if math.abs(recoil_vel) > 0.01 then
--look, I know this doesn't really make sense, but this is the best I can do atm. I've looked for better and mroe intuitive methods, I cannot find them.
--8-(8*(1-(8/100))
--recoil_vel = recoil_vel-((recoil_vel-(recoil_vel/(1+self.properties.recoil.velocity_correction_factor[axis])))*dt*10)
recoil_vel = recoil_vel * (recoil_vel/(recoil_vel/(self.properties.recoil.velocity_correction_factor[axis]*2))*dt)
--this is modelled off a geometric sequence where the Y incercept of the sequence is set to recoil_vel.
if math.abs(recoil_vel) > 0.001 then
local r = (10*self.properties.recoil.velocity_correction_factor[axis])^-1
local vel_co = e^-( (self.time_since_last_fire^2)/(2*r^2) )
recoil_vel = self.velocities.init_recoil[axis][i]*vel_co
else
recoil_vel = 0
end
if math.abs(recoil_vel)>math.abs(old_recoil_vel) then
recoil_vel = 0
end
self.velocities.recoil[axis][i] = recoil_vel
--ax^2+bx+c
--recoil_velocity_correction_rate
--recoil_correction_rate
local old_recoil = recoil
if math.abs(recoil) > 0.001 then
local correction_multiplier = self.time_since_last_fire*self.properties.recoil.target_correction_factor[axis]
local correction_value = recoil*correction_multiplier
correction_value = Guns4d.math.clamp(math.abs(correction_value), 0, self.properties.recoil.target_correction_max_rate[axis])
recoil=recoil-(correction_value*dt*(math.abs(recoil)/recoil))
local abs = math.abs(recoil)
local sign = old_recoil/abs
if abs > 0.001 then
local correction_value = abs*self.time_since_last_fire*self.properties.recoil.target_correction_factor[axis]
correction_value = Guns4d.math.clamp(correction_value, 0, self.properties.recoil.target_correction_max_rate[axis])
abs=abs-(correction_value*dt)
--prevent overcorrection
if math.abs(recoil) > math.abs(old_recoil) then
recoil = 0
if abs < 0 then
abs = 0
end
end
self.velocities.recoil[axis][i] = recoil_vel
self.offsets.recoil[axis][i] = recoil
if sign~=sign then
sign = 1
end
self.offsets.recoil[axis][i] = abs*sign
end
end
end

View File

@ -1,5 +1,5 @@
--- Instantiatable_class. The system for defining classes in 4dguns. Please note the capital "I", Ldoc converts it to a lowercase in all of this file
-- @classmod Instantiatable_class
--- The system for defining classes in 4dguns. Please note the capital "I", Ldoc converts it to a lowercase in all of this file
-- @class Instantiatable_class
Instantiatable_class = {
instance = false,

View File

@ -173,7 +173,7 @@ end
function player_handler:is_holding_gun()
assert(self.instance, "attempt to call object method on a class")
if self.wielded_item then
for name, obj in pairs(Guns4d.gun.registered) do
for name, obj in pairs(Guns4d.gun._registered) do
if obj.itemstring == self.wielded_item:get_name() then
return obj
end

View File

@ -157,9 +157,9 @@ local function initialize_b3d_animation_data(self, props)
}
--print(table.tostring(self.b3d_model))
--precalculate keyframe "samples" for intepolation.
local left = mtul.b3d_nodes.get_node_by_name(self.b3d_model, props.visuals.arm_left, true)
local right = mtul.b3d_nodes.get_node_by_name(self.b3d_model, props.visuals.arm_right, true)
local main = mtul.b3d_nodes.get_node_by_name(self.b3d_model, props.visuals.root, true)
local left = mtul.b3d_nodes.get_node_by_name(self.b3d_model, self.consts.ARM_LEFT_BONE, true)
local right = mtul.b3d_nodes.get_node_by_name(self.b3d_model, self.consts.ARM_RIGHT_BONE, true)
local main = mtul.b3d_nodes.get_node_by_name(self.b3d_model, self.consts.ROOT_BONE, true)
--we add 2 because we have to add 1 for the loop to make it there if it's a float val, and MTUL uses a system where frame 0 is 1
for target_frame = 0, self.b3d_model.node.animation.frames+1, self.consts.KEYFRAME_SAMPLE_PRECISION do
--we need to check that the bone exists first.
@ -261,6 +261,7 @@ function gun_default:construct_base_class()
self.consts = Guns4d.table.fill(self.parent_class.consts, self.consts or {})
props = self.properties
validate_controls(props)
assert((self.properties.recoil.velocity_correction_factor.gun_axial>=1) and (self.properties.recoil.velocity_correction_factor.player_axial>=1), "velocity correction must not be less than one.")
initialize_b3d_animation_data(self, props) --this is for animation offsets (like the spritescope uses)
@ -278,6 +279,6 @@ function gun_default:construct_base_class()
self.accepted_magazines[v] = true
end
Guns4d.gun.registered[self.name] = self --add gun self to the registered table
Guns4d.gun._registered[self.name] = self --add gun self to the registered table
register_visual_entity(self, props) --register the visual entity
end

View File

@ -1,11 +0,0 @@
project="4dguns"
title="4dguns documentation"
description="THEE ultimate 3d gun library."
format="markdown"
backtick_references=false
file = {
"../",
}
dir='./outputted documentation'
readme='../README.md'
style='!new'

View File

@ -1,3 +0,0 @@
guns4d_classes = {
"Gun"
}

View File

@ -1,50 +0,0 @@
local config = {}
local ld_chunk = assert(loadfile("./config.ld"))
setfenv(ld_chunk, config)
ld_chunk()
local guns4d_chunk = assert(loadfile("./config.guns4d"))
setfenv(guns4d_chunk, config)
guns4d_chunk()
function trim_leading_space(line)
local white_space = 0
while string.sub(line, 1, 1) == " " do
line = string.sub(line, 2)
white_space = white_space+1
end
return line, white_space
end
--there should be
function generate_field_hyperlink_string(name)
return "<a name = \""..name.."\"></a>"
end
local field_tag = "<h3>Fields:</h3>"
for _, class in pairs(config.guns4d_classes) do
--read the file, break down into a modifiable structure.
local fp = config.dir.."/classes/"..class..".html"
local file_stream = io.open(fp, "r")
assert(file_stream, "file not found while generating class docs, check class '"..class.."' is tagged as an @class")
local line = 0
local file = {}
for line_text in file_stream:lines("*a") do
line=line+1
file[line]=line_text
end
--find fields and their associated class (with their hyperlink)
for i, text in pairs(file) do
--print(i,text)
local trm_text, indent = trim_leading_space(text)
if trm_text==field_tag then
local line = i
while
do
end
end
end
end

View File

@ -1,13 +0,0 @@
#! /bin/sh
# on github, leafo/gh-actions-lua leafo/gh-actions-luarocks setup luarocks for us.
#~ sudo apt-get install lua5.3 liblua5.3-dev luarocks
# github ldoc is far ahead of the released version.
echo ldoc version:
git ls-remote https://github.com/lunarmodules/LDoc master
luarocks --local install https://raw.githubusercontent.com/lunarmodules/LDoc/master/ldoc-scm-3.rockspec
echo
cd ./doc
~/.luarocks/bin/ldoc .

BIN
docs/luadox/luadox Normal file

Binary file not shown.

28
docs/luadox/luadox.conf Normal file
View File

@ -0,0 +1,28 @@
[project]
# Project name that is displayed on the top bar of each page
name = Guns4d | The ultimate 3d gun mod.
# HTML title that is appended to every page. If not defined, name is used.
title = Guns4d
# A list of files or directories for LuaDox to parse. Globs are supported.
# This can be spread across multiple lines if you want, as long as the
# other lines are indented.
files = ../../*.lua
../../classes/*.lua
# The directory containing the rendered output files, which will be created
# if necessary.
outdir = ../out
# Path to a custom css file that will be included on every page. This will
# be copied into the outdir.
# css = custom.css
# Path to a custom favicon. This will be copied into the outdir.
# favicon = img/favicon.png
# If require()d files discovered in source should also be parsed.
follow = true
[manual]
# Custom manual pages in the form: id = filename.
#
# The ids must not conflict with any class or module name otherwise references
# will not properly resolve.
# index = intro.md
# tutorial = tut.md

4
docs/luadox/run.bat Normal file
View File

@ -0,0 +1,4 @@
::literally just so I dont have to open powershell every time.
::python 3.8+ required.
@echo off
python ./luadox -c ./luadox.conf

780
docs/out/class/Gun.html Normal file
View File

@ -0,0 +1,780 @@
<!DOCTYPE html>
<html lang="en">
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Gun - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head>
<body class="class-gun">
<div class="topbar">
<div class="group one">
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
</div>
<div class="group two">
</div>
<div class="group three">
<div class="button iconright"><a href="../class/Instantiatable_class.html" title="Instantiatable_class"><span>Next</span><img src="../img/i-right.svg?7653a2d" alt=""/></a></div>
</div>
</div>
<div class="sidebar">
<form action="../search.html">
<input class="search" name="q" type="search" placeholder="Search" />
</form>
<div class="sections">
<div class="heading">Contents</div>
<ul>
<li><a href="#Gun">Class <code>Gun</code></a></li>
<li><a href="#gun"><p>gun fields</p>
</a></li>
<li><a href="#lvl1_fields.properties"><p>properties</p>
</a></li>
<li><a href="#gun.properties.hip"><p>properties.hip</p>
</a></li>
<li><a href="#gun.properties.ads"><p>properties.ads</p>
</a></li>
<li><a href="#gun.properties.firemodes"><p>properties.firemodes</p>
</a></li>
<li><a href="#gun.properties.firemode_inventory_overlays"><p>properties.firemode_inventory_overlays</p>
</a></li>
<li><a href="#gun.properties.recoil"><p>properties.recoil</p>
</a></li>
<li><a href="#gun.properties.sway"><p>properties.sway</p>
</a></li>
<li><a href="#gun.properties.wag"><p>properties.wag</p>
</a></li>
<li><a href="#gun.properties.charging"><p>properties.charging</p>
</a></li>
<li><a href="#gun.properties.ammo"><p>properties.ammo</p>
</a></li>
<li><a href="#gun.properties.visuals"><p>properties.visuals</p>
</a></li>
<li><a href="#lvl1_fields.offsets"><p>offsets</p>
</a></li>
<li><a href="#lvl1_fields.consts"><p>consts</p>
</a></li>
</ul>
</div>
<div class="classes">
<div class="heading">Classes</div>
<ul>
<li class="selected"><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/Instantiatable_class.html">Instantiatable_class.Instantiatable_class</a></li>
</ul>
</div>
<div class="modules">
<div class="heading">Modules</div>
<ul>
<li><a href="../module/misc_helpers.html">misc_helpers</a></li>
<li><a href="../module/play_sound.html">play_sound</a></li>
<li><a href="../module/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="../module/Control_handler.html">Control_handler</a></li>
<li><a href="../module/Player_model_handler.html">Player_model_handler</a></li>
</ul>
</div>
</div>
<div class="body">
<div class="section">
<h2 class="class" id="Gun">Class <code>Gun</code>
<a class="permalink" href="#Gun" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>Gun class</p>
<h2>Defining a gun:</h2>
<p><strong>method documentation coming soon</strong> (or never...)</p>
<p>guns are defined by two table fields: their <a href="../class/Gun.html#lvl1_fields.consts">consts</a> and their <a href="../class/Gun.html#lvl1_fields.properties">properties</a>.
<a href="../class/Gun.html#lvl1_fields.properties">properties</a> define nearly everything, from how a gun handles to how it looks, what model it uses,
while <a href="../class/Gun.html#lvl1_fields.consts">consts</a> 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.</p>
<p>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 &quot;__template&quot; for template classes of guns.</p>
</div>
</div>
<div class="section">
<h2 class="table" id="gun">gun fields
<a class="permalink" href="#gun" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties">properties</var><a class="permalink" href="#gun.properties" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../class/Gun.html#lvl1_fields.properties">properties</a> which define the vast majority of gun attributes and may change accross instances</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.consts">consts</var><a class="permalink" href="#gun.consts" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../class/Gun.html#lvl1_fields.consts">constancts</a> which define gun attributes and should not be changed in an instance of the gun</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.offsets">offsets</var><a class="permalink" href="#gun.offsets" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../class/Gun.html#lvl1_fields.offsets">properties</a> runtime storage of offsets generated by recoil sway wag or any other element.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.name">name</var><a class="permalink" href="#gun.name" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> the name of the gun. Set to __template for guns which have no instances.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.itemstack">itemstack</var><a class="permalink" href="#gun.itemstack" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>ItemStack</code> itemstack held by the player</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.gun_entity">gun_entity</var><a class="permalink" href="#gun.gun_entity" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>ObjRef</code> the gun entity</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.itemstring">itemstring</var><a class="permalink" href="#gun.itemstring" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> the itemstring of the gun- i.e. &quot;guns4d_pack_1:m4&quot;. Set to &quot;&quot; for __template guns.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun._registered">_registered</var><a class="permalink" href="#gun._registered" title="Permalink to this definition"></a></td>
<td class="doc"><p>list of registered guns, <strong>DO NOT MODIFY</strong> I really need a metatable for this class...</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.bolt_charged">bolt_charged</var><a class="permalink" href="#gun.bolt_charged" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code> is the bolt charged</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.particle_spawners">particle_spawners</var><a class="permalink" href="#gun.particle_spawners" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> list of particle spawner handles (generated by firing)</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.current_firemode">current_firemode</var><a class="permalink" href="#gun.current_firemode" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>int</code> the active index of the firemode from <a href="../class/Gun.html#lvl1_fields.properties.firemodes">lvl1_fields.properties.firemodes</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.walking_tick">walking_tick</var><a class="permalink" href="#gun.walking_tick" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> walking time used to generate the figure 8 for wag</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.time_since_last_fire">time_since_last_fire</var><a class="permalink" href="#gun.time_since_last_fire" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.time_since_creation">time_since_creation</var><a class="permalink" href="#gun.time_since_creation" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.rechamber_time">rechamber_time</var><a class="permalink" href="#gun.rechamber_time" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> time left for the chamber to cycle (for firerates)</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.burst_queue">burst_queue</var><a class="permalink" href="#gun.burst_queue" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>int</code> number of rounds left that need to be fired after a burst fire</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.muzzle_flash">muzzle_flash</var><a class="permalink" href="#gun.muzzle_flash" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>function</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.animation_rotation">animation_rotation</var><a class="permalink" href="#gun.animation_rotation" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> containing the offset from animations, this will be generated if {@consts.ANIMATIONS_OFFSET_AIM}=true</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.total_offset_rotation">total_offset_rotation</var><a class="permalink" href="#gun.total_offset_rotation" title="Permalink to this definition"></a></td>
<td class="doc"><p>total offsets of the gun in the same format as a <a href="../class/Gun.html#gun.offsets">an offset</a></p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="lvl1_fields.properties">properties
<a class="permalink" href="#lvl1_fields.properties" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>the table containing every attribute of the gun.</p>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="lvl1_fields.properties.hip">hip</var><a class="permalink" href="#lvl1_fields.properties.hip" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../class/Gun.html#gun.properties.hip">hipfire properties</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.ads">ads</var><a class="permalink" href="#lvl1_fields.properties.ads" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../class/Gun.html#gun.properties.ads">aiming (&quot;aiming down sights&quot;) properties</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.firemodes">firemodes</var><a class="permalink" href="#lvl1_fields.properties.firemodes" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../class/Gun.html#gun.properties.firemodes">list of firemodes</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.firemode_inventory_overlays">firemode_inventory_overlays</var><a class="permalink" href="#lvl1_fields.properties.firemode_inventory_overlays" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../class/Gun.html#gun.properties.firemode_inventory_overlays">list of corresponding images for firemodes</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.recoil">recoil</var><a class="permalink" href="#lvl1_fields.properties.recoil" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../class/Gun.html#gun.properties.recoil">defines the guns recoil</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.sway">sway</var><a class="permalink" href="#lvl1_fields.properties.sway" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../class/Gun.html#gun.properties.sway">defines the guns idle sway</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.wag">wag</var><a class="permalink" href="#lvl1_fields.properties.wag" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../class/Gun.html#gun.properties.wag">defines the movement of the gun while walking</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.charging">charging</var><a class="permalink" href="#lvl1_fields.properties.charging" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> <a href="../class/Gun.html#gun.properties.charging">defines how rounds are chambered into the gun</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.ammo">ammo</var><a class="permalink" href="#lvl1_fields.properties.ammo" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../class/Gun.html#gun.properties.ammo">defines what ammo the gun uses</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.visuals">visuals</var><a class="permalink" href="#lvl1_fields.properties.visuals" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../class/Gun.html#gun.properties.visuals">defines visual attributes of the gun</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.breathing_scale">breathing_scale</var><a class="permalink" href="#lvl1_fields.properties.breathing_scale" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code>=.5 max angular deviation (vertical) from breathing</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.flash_offset">flash_offset</var><a class="permalink" href="#lvl1_fields.properties.flash_offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> the offset from the center of the muzzle flash. Used by fire()</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.firerateRPM">firerateRPM</var><a class="permalink" href="#lvl1_fields.properties.firerateRPM" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>int</code>=600 The number of rounds (cartidges) this gun can throw per minute. Used by update(), fire() and default controls</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.item">item</var><a class="permalink" href="#lvl1_fields.properties.item" title="Permalink to this definition"></a></td>
<td class="doc"><p>the item entity's attributes. This will later include held item definition...</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.burst">burst</var><a class="permalink" href="#lvl1_fields.properties.burst" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>int</code>=3 how many rounds in burst using when firemode is at &quot;burst&quot;</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.infinite_inventory_overlay">infinite_inventory_overlay</var><a class="permalink" href="#lvl1_fields.properties.infinite_inventory_overlay" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> overlay on the item to use when infinite ammo is on</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.pc_control_actions">pc_control_actions</var><a class="permalink" href="#lvl1_fields.properties.pc_control_actions" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> containing a list of actions for PC users passed to <a href="../module/Control_handler.html">Control_handler</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.touch_control_actions">touch_control_actions</var><a class="permalink" href="#lvl1_fields.properties.touch_control_actions" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> containing a list of actions for touch screen users passed to <a href="../module/Control_handler.html">Control_handler</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.reload">reload</var><a class="permalink" href="#lvl1_fields.properties.reload" title="Permalink to this definition"></a></td>
<td class="doc"><p>and ordered list of reloading states used by default_controls.</p>
<p>the default reload states for a magazine operated weapon, copied from the m4.</p>
<h5>Example</h5>
<pre><code class="language-lua">{action=&quot;charge&quot;, time=.5, anim=&quot;charge&quot;, sounds={sound=&quot;ar_charge&quot;, delay = .2}},
{action=&quot;unload_mag&quot;, time=.25, anim=&quot;unload&quot;, sounds = {sound=&quot;ar_mag_unload&quot;}},
{action=&quot;store&quot;, time=.5, anim=&quot;store&quot;, sounds = {sound=&quot;ar_mag_store&quot;}},
{action=&quot;load&quot;, time=.5, anim=&quot;load&quot;, sounds = {sound=&quot;ar_mag_load&quot;, delay = .25}},
{action=&quot;charge&quot;, time=.5, anim=&quot;charge&quot;, sounds={sound=&quot;ar_charge&quot;, delay = .2}}
</code></pre>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.properties.sounds">sounds</var><a class="permalink" href="#lvl1_fields.properties.sounds" title="Permalink to this definition"></a></td>
<td class="doc"><p>a table of <a href="../module/play_sound.html#guns4d_soundspec">soundspecs</a> to be referenced by other functions</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.hip">properties.hip
<a class="permalink" href="#gun.properties.hip" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.hip.offset">offset</var><a class="permalink" href="#gun.properties.hip.offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> the offset of the gun (relative to the right arm's default position) at hip.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.hip.axis_rotation_ratio">axis_rotation_ratio</var><a class="permalink" href="#gun.properties.hip.axis_rotation_ratio" title="Permalink to this definition"></a></td>
<td class="doc"><p>the ratio that the look rotation is expressed through player_axial (rotated around the viewport) rotation as opposed to gun_axial (rotating the entity).</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.hip.sway_vel_mul">sway_vel_mul</var><a class="permalink" href="#gun.properties.hip.sway_vel_mul" title="Permalink to this definition"></a></td>
<td class="doc"><p>sway speed multiplier while at hip</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.hip.sway_angle_mul">sway_angle_mul</var><a class="permalink" href="#gun.properties.hip.sway_angle_mul" title="Permalink to this definition"></a></td>
<td class="doc"><p>sway angle multiplier while at hip+</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.ads">properties.ads
<a class="permalink" href="#gun.properties.ads" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.ads.offset">offset</var><a class="permalink" href="#gun.properties.ads.offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> the offset of the gun relative to the eye's position at hip.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.ads.horizontal_offset">horizontal_offset</var><a class="permalink" href="#gun.properties.ads.horizontal_offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> the horizontal offset of the eye when aiming</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.ads.aim_time">aim_time</var><a class="permalink" href="#gun.properties.ads.aim_time" title="Permalink to this definition"></a></td>
<td class="doc"><p>the time it takes to go into full aim</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.firemodes">properties.firemodes
<a class="permalink" href="#gun.properties.firemodes" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>list containing the firemodes of the gun. Default only contains &quot;single&quot;. Strings allowed by default:</p>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.firemodes."single"">"single"</var><a class="permalink" href="#gun.properties.firemodes."single"" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="gun.properties.firemodes."burst"">"burst"</var><a class="permalink" href="#gun.properties.firemodes."burst"" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="gun.properties.firemodes."auto"">"auto"</var><a class="permalink" href="#gun.properties.firemodes."auto"" title="Permalink to this definition"></a></td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.firemode_inventory_overlays">properties.firemode_inventory_overlays
<a class="permalink" href="#gun.properties.firemode_inventory_overlays" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>defines the overlay on the gun item for each firemode. These are selected automatically by firemode string. Defaults are as follows:</p>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.firemode_inventory_overlays.single">single</var><a class="permalink" href="#gun.properties.firemode_inventory_overlays.single" title="Permalink to this definition"></a></td>
<td class="doc"><p>&quot;inventory_overlay_single.png&quot;</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.firemode_inventory_overlays.auto">auto</var><a class="permalink" href="#gun.properties.firemode_inventory_overlays.auto" title="Permalink to this definition"></a></td>
<td class="doc"><p>&quot;inventory_overlay_auto.png&quot;</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.firemode_inventory_overlays.burst">burst</var><a class="permalink" href="#gun.properties.firemode_inventory_overlays.burst" title="Permalink to this definition"></a></td>
<td class="doc"><p>&quot;inventory_overlay_burst.png&quot;</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.firemode_inventory_overlays.safe">safe</var><a class="permalink" href="#gun.properties.firemode_inventory_overlays.safe" title="Permalink to this definition"></a></td>
<td class="doc"><p>&quot;inventory_overlay_safe.png&quot; (unimplemented firemode)</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.recoil">properties.recoil
<a class="permalink" href="#gun.properties.recoil" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p><strong>IMPORTANT</strong>: expects fields to be tables containing a &quot;gun_axial&quot; and &quot;player_axial&quot; field.</p>
<h5>Example</h5>
<pre><code class="language-lua">property = {
gun_axial = type
player_axial = type
}
--using a vector...
property = {
gun_axial={x=float, y=float},
player_axial={x=float, y=float}
}`
</code></pre>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.recoil.velocity_correction_factor">velocity_correction_factor</var><a class="permalink" href="#gun.properties.recoil.velocity_correction_factor" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> TL:DR higher decreases recoil at expense of smoothness. 1/value is the deviation of a normalized bell curve, where x is the time since firing.
this means that increasing it decreases the time it takes for the angular velocity to fully &quot;decay&quot;.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.target_correction_factor">target_correction_factor</var><a class="permalink" href="#gun.properties.recoil.target_correction_factor" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> Correction of recoil offset per second is calculated as such: <code>target_correction_factor[axis]*time_since_fire*recoil[axis]</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.target_correction_max_rate">target_correction_max_rate</var><a class="permalink" href="#gun.properties.recoil.target_correction_max_rate" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> The maximum rate per second of recoil offset as determined with <a href="../class/Gun.html#gun.properties.recoil.target_correction_factor">gun.properties.recoil.target_correction_factor</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.angular_velocity_max">angular_velocity_max</var><a class="permalink" href="#gun.properties.recoil.angular_velocity_max" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> caps the recoil velocity that can stack up from shots.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.angular_velocity">angular_velocity</var><a class="permalink" href="#gun.properties.recoil.angular_velocity" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> {x=<code>float</code>, y=<code>float</code>}, defines the initial angular velocity produced by firing the gun</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.bias">bias</var><a class="permalink" href="#gun.properties.recoil.bias" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vector</code> {x=<code>float</code>, y=<code>float</code>}, ranges -1 to 1. Defines the probability of the recoil being positive or negative for any given axis.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.recoil.hipfire_multiplier">hipfire_multiplier</var><a class="permalink" href="#gun.properties.recoil.hipfire_multiplier" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> angular velocity multiplier when firing from the hip</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.sway">properties.sway
<a class="permalink" href="#gun.properties.sway" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p><strong>IMPORTANT</strong>: expects fields to be tables containing a &quot;gun_axial&quot; and &quot;player_axial&quot; field. In the same format as <a href="../class/Gun.html#gun.properties.recoil">gun.properties.recoil</a></p>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.sway.max_angle">max_angle</var><a class="permalink" href="#gun.properties.sway.max_angle" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> maximum angle of the sway</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.sway.angular_velocity">angular_velocity</var><a class="permalink" href="#gun.properties.sway.angular_velocity" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> angular velocity the sway</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.sway.hipfire_angle_multiplier">hipfire_angle_multiplier</var><a class="permalink" href="#gun.properties.sway.hipfire_angle_multiplier" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> maximum angle multiplier while the gun is at the hip</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.sway.hipfire_velocity_multiplier">hipfire_velocity_multiplier</var><a class="permalink" href="#gun.properties.sway.hipfire_velocity_multiplier" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> velocity multiplier while the gun is at the hip</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.wag">properties.wag
<a class="permalink" href="#gun.properties.wag" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.wag.cycle_speed">cycle_speed</var><a class="permalink" href="#gun.properties.wag.cycle_speed" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code>=1.6 the cycle speed multiplier</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.wag.decay_speed">decay_speed</var><a class="permalink" href="#gun.properties.wag.decay_speed" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code>=1 decay factor when walking has stopped and offset remains.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.wag.offset">offset</var><a class="permalink" href="#gun.properties.wag.offset" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> containing angular deviation while walking in the same format as <a href="../class/Gun.html#gun.properties.recoil">an offset vector</a>. Acts as a multiplier on the figure-8 generated while walking.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.charging">properties.charging
<a class="permalink" href="#gun.properties.charging" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.charging.require_draw_on_swap">require_draw_on_swap</var><a class="permalink" href="#gun.properties.charging.require_draw_on_swap" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code> defines wether the draw animation is played on swap (when loaded). Used in the instance construction method</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.charging.bolt_charge_mode">bolt_charge_mode</var><a class="permalink" href="#gun.properties.charging.bolt_charge_mode" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> &quot;none&quot; bolt will never need to be charged after reload, &quot;catch&quot; when fired to empty bolt will not need to be charged after reload, &quot;no_catch&quot; bolt will always need to be charged after reload.</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.charging.draw_time">draw_time</var><a class="permalink" href="#gun.properties.charging.draw_time" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> the time it takes to swap to the gun</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.charging.draw_animation">draw_animation</var><a class="permalink" href="#gun.properties.charging.draw_animation" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> name of the animation to play from <a href="../class/Gun.html#gun.properties.visuals.animations">visuals.animations</a></p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.charging.draw_sound">draw_sound</var><a class="permalink" href="#gun.properties.charging.draw_sound" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> name of the sound to play from sounds</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.ammo">properties.ammo
<a class="permalink" href="#gun.properties.ammo" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.ammo.accepted_bullets">accepted_bullets</var><a class="permalink" href="#gun.properties.ammo.accepted_bullets" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> a list of accepted bullet itemstrings</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.ammo.accepted_magazines">accepted_magazines</var><a class="permalink" href="#gun.properties.ammo.accepted_magazines" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> a list of accepted magazine itemstrings</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.ammo.initial_mag">initial_mag</var><a class="permalink" href="#gun.properties.ammo.initial_mag" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code> the mag the gun starts with. Set to &quot;empty&quot; for no mag, otherwise it defaults to accepted_magazines[1] (if present)</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="gun.properties.visuals">properties.visuals
<a class="permalink" href="#gun.properties.visuals" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="gun.properties.visuals.backface_culling">backface_culling</var><a class="permalink" href="#gun.properties.visuals.backface_culling" title="Permalink to this definition"></a></td>
<td class="doc"><p>toggles backface culling</p>
</td>
</tr>
<tr>
<td class="name"><var id="gun.properties.visuals.animations">animations</var><a class="permalink" href="#gun.properties.visuals.animations" title="Permalink to this definition"></a></td>
<td class="doc"><p>a table of animations in the format {x=int, y=float}. Indexes define the name of the animation to be refrenced by other functions of the gun.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="lvl1_fields.offsets">offsets
<a class="permalink" href="#lvl1_fields.offsets" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>a list of tables each containing two vectors, a gun_axial offset and a player_axial offset. These are required for automatic initialization of offsets.</p>
<h5>Example</h5>
<pre><code class="language-lua">recoil = {
gun_axial = {x=0, y=0}
player_axial = {x=0, y=0}
}
</code></pre>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="lvl1_fields.offsets.recoil">recoil</var><a class="permalink" href="#lvl1_fields.offsets.recoil" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.offsets.sway">sway</var><a class="permalink" href="#lvl1_fields.offsets.sway" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.offsets.walking">walking</var><a class="permalink" href="#lvl1_fields.offsets.walking" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.offsets.breathing">breathing</var><a class="permalink" href="#lvl1_fields.offsets.breathing" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.offsets.look_snap">look_snap</var><a class="permalink" href="#lvl1_fields.offsets.look_snap" title="Permalink to this definition"></a></td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="lvl1_fields.consts">consts
<a class="permalink" href="#lvl1_fields.consts" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>These are variables that are constant across the class and should usually not ever be changed by instnaces</p>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="lvl1_fields.consts.AIM_OUT_AIM_IN_SPEED_RATIO">AIM_OUT_AIM_IN_SPEED_RATIO</var><a class="permalink" href="#lvl1_fields.consts.AIM_OUT_AIM_IN_SPEED_RATIO" title="Permalink to this definition"></a></td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.KEYFRAME_SAMPLE_PRECISION">KEYFRAME_SAMPLE_PRECISION</var><a class="permalink" href="#lvl1_fields.consts.KEYFRAME_SAMPLE_PRECISION" title="Permalink to this definition"></a></td>
<td class="doc"><p>frequency of keyframe samples for animation offsets and</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.DEFAULT_MAX_HEAR_DISTANCE">DEFAULT_MAX_HEAR_DISTANCE</var><a class="permalink" href="#lvl1_fields.consts.DEFAULT_MAX_HEAR_DISTANCE" title="Permalink to this definition"></a></td>
<td class="doc"><p>default max hear distance when not specified</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.DEFAULT_FPS">DEFAULT_FPS</var><a class="permalink" href="#lvl1_fields.consts.DEFAULT_FPS" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>fps</code>=60 animation fps i.e. during firing when no length is specified</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_RECOIL">HAS_RECOIL</var><a class="permalink" href="#lvl1_fields.consts.HAS_RECOIL" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_BREATHING">HAS_BREATHING</var><a class="permalink" href="#lvl1_fields.consts.HAS_BREATHING" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_SWAY">HAS_SWAY</var><a class="permalink" href="#lvl1_fields.consts.HAS_SWAY" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_WAG">HAS_WAG</var><a class="permalink" href="#lvl1_fields.consts.HAS_WAG" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.HAS_GUN_AXIAL_OFFSETS">HAS_GUN_AXIAL_OFFSETS</var><a class="permalink" href="#lvl1_fields.consts.HAS_GUN_AXIAL_OFFSETS" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code> wether the gun rotates on it's own axis instead of the player's view (i.e. ironsight misalignments)</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.ANIMATIONS_OFFSET_AIM">ANIMATIONS_OFFSET_AIM</var><a class="permalink" href="#lvl1_fields.consts.ANIMATIONS_OFFSET_AIM" title="Permalink to this definition"></a></td>
<td class="doc"><p>wether animations create an offset</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.LOOP_IDLE_ANIM">LOOP_IDLE_ANIM</var><a class="permalink" href="#lvl1_fields.consts.LOOP_IDLE_ANIM" title="Permalink to this definition"></a></td>
<td class="doc"><p>whether the idle animation changes or not</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.THIRD_PERSON_GAIN_MULTIPLIER">THIRD_PERSON_GAIN_MULTIPLIER</var><a class="permalink" href="#lvl1_fields.consts.THIRD_PERSON_GAIN_MULTIPLIER" title="Permalink to this definition"></a></td>
<td class="doc"><p>general gain multiplier for third persons when hearing sounds</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.ROOT_BONE">ROOT_BONE</var><a class="permalink" href="#lvl1_fields.consts.ROOT_BONE" title="Permalink to this definition"></a></td>
<td class="doc"><p>the root bone of the gun (for animation offsets)</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.MAG_BONE">MAG_BONE</var><a class="permalink" href="#lvl1_fields.consts.MAG_BONE" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code>=&quot;magazine&quot;,the bone of the magazine in the gun (for dropping mags)</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.ARM_RIGHT_BONE">ARM_RIGHT_BONE</var><a class="permalink" href="#lvl1_fields.consts.ARM_RIGHT_BONE" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code>=&quot;right_aimpoint&quot;, the bone which the right arm aims at to</p>
</td>
</tr>
<tr>
<td class="name"><var id="lvl1_fields.consts.ARM_LEFT_BONE">ARM_LEFT_BONE</var><a class="permalink" href="#lvl1_fields.consts.ARM_LEFT_BONE" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>string</code>=&quot;left_aimpoint&quot;, the bone which the left arm aims at to</p>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<script src="../prism.js?7653a2d"></script>
</body>
</html>

View File

@ -0,0 +1,155 @@
<!DOCTYPE html>
<html lang="en">
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Instantiatable_class - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head>
<body class="class-instantiatable_class">
<div class="topbar">
<div class="group one">
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
</div>
<div class="group two">
</div>
<div class="group three">
<div class="button iconleft"><a href="../class/Gun.html" title="Gun"><img src="../img/i-left.svg?7653a2d" alt=""/><span>Previous</span></a></div>
<div class="button iconright"><a href="../module/misc_helpers.html" title="misc_helpers"><span>Next</span><img src="../img/i-right.svg?7653a2d" alt=""/></a></div>
</div>
</div>
<div class="sidebar">
<form action="../search.html">
<input class="search" name="q" type="search" placeholder="Search" />
</form>
<div class="sections">
<div class="heading">Contents</div>
<ul>
<li><a href="#Instantiatable_class">Class <code>Instantiatable_class</code></a></li>
<li><a href="#god_work"><p>Instantiatable_class</p>
</a></li>
</ul>
</div>
<div class="classes">
<div class="heading">Classes</div>
<ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li>
<li class="selected"><a href="../class/Instantiatable_class.html">Instantiatable_class.Instantiatable_class</a></li>
</ul>
</div>
<div class="modules">
<div class="heading">Modules</div>
<ul>
<li><a href="../module/misc_helpers.html">misc_helpers</a></li>
<li><a href="../module/play_sound.html">play_sound</a></li>
<li><a href="../module/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="../module/Control_handler.html">Control_handler</a></li>
<li><a href="../module/Player_model_handler.html">Player_model_handler</a></li>
</ul>
</div>
</div>
<div class="body">
<div class="section">
<h2 class="class" id="Instantiatable_class">Class <code>Instantiatable_class</code>
<a class="permalink" href="#Instantiatable_class" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>The system for defining classes in 4dguns. Please note the capital &quot;I&quot;, Ldoc converts it to a lowercase in all of this file</p>
<div class="synopsis">
<h3>Synopsis</h3>
<div class="heading">Methods</div>
<table class="functions ">
<tr>
<td class="name"><a href="#Instantiatable_class.inherit"><var>inherit</var></a>()</td>
<td class="doc"><p>creates a new base class</p>
</td>
</tr>
<tr>
<td class="name"><a href="#Instantiatable_class.new"><var>new</var></a>()</td>
<td class="doc"><p>creates an instance of the base class</p>
</td>
</tr>
</table>
</div>
<dl class="functions">
<dt id="Instantiatable_class.inherit">
<span class="icon"></span><var>Instantiatable_class:inherit</var>(<em>def</em>)
<a class="permalink" href="#Instantiatable_class.inherit" title="Permalink to this definition"></a>
</dt>
<dd>
<p>creates a new base class. Calls all constructors in the chain with def.instance=true</p>
</dd>
<dt id="Instantiatable_class.new">
<span class="icon"></span><var>Instantiatable_class:new</var>(<em>def</em>)
<a class="permalink" href="#Instantiatable_class.new" title="Permalink to this definition"></a>
</dt>
<dd>
<p>creates an instance of the base class. Calls all constructors in the chain with def.instance=true</p>
</dd>
</dl>
</div>
</div>
<div class="section">
<h2 class="table" id="god_work">Instantiatable_class
<a class="permalink" href="#god_work" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<h3>Synopsis</h3>
<div class="heading">Fields</div>
<table class="fields ">
<tr>
<td class="name"><a href="#god_work.instance"><var>instance</var></a></td>
<td class="doc"><p>defines wether the object is an instance</p>
</td>
</tr>
<tr>
<td class="name"><a href="#god_work.base_class"><var>base_class</var></a></td>
<td class="doc"><p>only present for instances: the class from which this instance originates</p>
</td>
</tr>
<tr>
<td class="name"><a href="#god_work.parent_class"><var>parent_class</var></a></td>
<td class="doc"><p>the class from which this class was inherited from</p>
</td>
</tr>
</table>
</div>
<dl class="fields">
<dt id="god_work.instance">
<span class="icon"></span><var>god_work.instance</var>
<a class="permalink" href="#god_work.instance" title="Permalink to this definition"></a>
</dt>
<dd>
<p>defines wether the object is an instance</p>
</dd>
<dt id="god_work.base_class">
<span class="icon"></span><var>god_work.base_class</var>
<a class="permalink" href="#god_work.base_class" title="Permalink to this definition"></a>
</dt>
<dd>
<p>only present for instances: the class from which this instance originates</p>
</dd>
<dt id="god_work.parent_class">
<span class="icon"></span><var>god_work.parent_class</var>
<a class="permalink" href="#god_work.parent_class" title="Permalink to this definition"></a>
</dt>
<dd>
<p>the class from which this class was inherited from</p>
</dd>
</dl>
</div>
</div>
</div>
<script src="../prism.js?7653a2d"></script>
</body>
</html>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M2.65 3C2.3 3 2 3.3 2 3.65C2 3.69 2 3.73 2 3.77L4.73 20.27C4.8 20.69 5.16 21 5.58 21H18.63C18.94 21 19.22 20.78 19.27 20.46L22 3.77C22.05 3.42 21.81 3.09 21.46 3.04C21.43 3.03 21.39 3.03 21.35 3.03L2.65 3M14.1 14.95H9.94L8.81 9.07H15.11L14.1 14.95Z" /></svg>

After

Width:  |  Height:  |  Size: 543 B

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z" /></svg>

After

Width:  |  Height:  |  Size: 336 B

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z" /></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M21.94 13.11L20.89 9.89C20.89 9.86 20.88 9.83 20.87 9.8L18.76 3.32C18.65 3 18.33 2.75 17.96 2.75C17.6 2.75 17.28 3 17.17 3.33L15.17 9.5H8.84L6.83 3.33C6.72 3 6.4 2.75 6.04 2.75H6.04C5.67 2.75 5.35 3 5.24 3.33L3.13 9.82C3.13 9.82 3.13 9.83 3.13 9.83L2.06 13.11C1.9 13.61 2.07 14.15 2.5 14.45L11.72 21.16C11.89 21.28 12.11 21.28 12.28 21.15L21.5 14.45C21.93 14.15 22.1 13.61 21.94 13.11M8.15 10.45L10.72 18.36L4.55 10.45M13.28 18.37L15.75 10.78L15.85 10.45H19.46L13.87 17.61M17.97 3.94L19.78 9.5H16.16M14.86 10.45L13.07 15.96L12 19.24L9.14 10.45M6.03 3.94L7.84 9.5H4.23M3.05 13.69C2.96 13.62 2.92 13.5 2.96 13.4L3.75 10.97L9.57 18.42M20.95 13.69L14.44 18.42L14.46 18.39L20.25 10.97L21.04 13.4C21.08 13.5 21.04 13.62 20.95 13.69" /></svg>

After

Width:  |  Height:  |  Size: 1020 B

1
docs/out/img/i-left.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z" /></svg>

After

Width:  |  Height:  |  Size: 365 B

1
docs/out/img/i-right.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z" /></svg>

After

Width:  |  Height:  |  Size: 366 B

49
docs/out/index.html Normal file
View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Search - Guns4d</title>
<link href="prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="luadox.css?7653a2d" type="text/css">
</head>
<body class="search-search">
<div class="topbar">
<div class="group one">
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
</div>
<div class="group two">
</div>
<div class="group three">
<div class="button iconright"><a href="class/Instantiatable_class.html" title="Instantiatable_class"><span>Next</span><img src="img/i-right.svg?7653a2d" alt=""/></a></div>
</div>
</div>
<div class="sidebar">
<form action="search.html">
<input class="search" name="q" type="search" placeholder="Search" />
</form>
<div class="classes">
<div class="heading">Classes</div>
<ul>
<li><a href="class/Gun.html">Gun.Gun</a></li>
<li><a href="class/Instantiatable_class.html">Instantiatable_class.Instantiatable_class</a></li>
</ul>
</div>
<div class="modules">
<div class="heading">Modules</div>
<ul>
<li><a href="module/misc_helpers.html">misc_helpers</a></li>
<li><a href="module/play_sound.html">play_sound</a></li>
<li><a href="module/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="module/Control_handler.html">Control_handler</a></li>
<li><a href="module/Player_model_handler.html">Player_model_handler</a></li>
</ul>
</div>
</div>
<div class="body">
</div>
<script src="prism.js?7653a2d"></script>
</body>
</html>

130
docs/out/index.js Normal file
View File

@ -0,0 +1,130 @@
var docs = [
{path:"class/Gun.html", type:"class", title:"Gun.Gun", text:"Gun class Defining a gun: *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."},
{path:"class/Instantiatable_class.html", type:"class", title:"Instantiatable_class.Instantiatable_class", text:"The system for defining classes in 4dguns. Please note the capital \"I\", Ldoc converts it to a lowercase in all of this file"},
{path:"module/misc_helpers.html", type:"module", title:"misc_helpers", text:""},
{path:"module/play_sound.html", type:"module", title:"play_sound", text:"implements tools for quickly playing audio."},
{path:"module/Bullet_hole.html", type:"module", title:"Bullet_hole", text:""},
{path:"module/Control_handler.html", type:"module", title:"Control_handler", text:""},
{path:"module/Player_model_handler.html", type:"module", title:"Player_model_handler", text:""},
{path:"module/play_sound.html#guns4d_soundspec.min_hear_distance", type:"field", title:"guns4d_soundspec.min_hear_distance", text:"float this is useful if you wish to play a sound which has a \"far\" sound, such as distant gunshots. incompatible with to_player"},
{path:"module/play_sound.html#guns4d_soundspec.sounds", type:"field", title:"guns4d_soundspec.sounds", text:"table a weighted_randoms table for randomly selecting sounds. The output will overwrite the sound field."},
{path:"module/play_sound.html#guns4d_soundspec.to_player", type:"field", title:"guns4d_soundspec.to_player", text:"objRef 4dguns changes to_player so it only plays positionless audio (as it is only intended for first person audio). If set to string \"from_player\" and player present"},
{path:"module/play_sound.html#guns4d_soundspec.player", type:"field", title:"guns4d_soundspec.player", text:"objRef this is so to_player being set to \"from_player\". It's to be set to the player which fired the weapon."},
{path:"module/play_sound.html#guns4d_soundspec.delay", type:"field", title:"guns4d_soundspec.delay", text:"float delays the playing of the sound"},
{path:"module/play_sound.html#guns4d_soundspec.attenuation_rate", type:"field", title:"guns4d_soundspec.attenuation_rate", text:"float the rate of dropoff for a sound. I figure this is a bit more intuitive then jacking the gain up super high for every sound... Set the default in config."},
{path:"module/play_sound.html#guns4d_soundspec.split_audio_by_perspective", type:"field", title:"guns4d_soundspec.split_audio_by_perspective", text:"bool [GUN CLASS SPECIFIC] tells the gun wether to split into third and first person (positionless) audio and adjust gain."},
{path:"module/play_sound.html#guns4d_soundspec.third_person_gain_multiplier", type:"field", title:"guns4d_soundspec.third_person_gain_multiplier", text:"float [GUN CLASS SPECIFIC] replaces the constant/config value \"third_person_gain_multiplier/THIRD_PERSON_GAIN_MULTIPLIER\"."},
{path:"class/Gun.html#gun.properties", type:"field", title:"gun.properties", text:"properties which define the vast majority of gun attributes and may change accross instances"},
{path:"class/Gun.html#gun.consts", type:"field", title:"gun.consts", text:"constancts which define gun attributes and should not be changed in an instance of the gun"},
{path:"class/Gun.html#gun.offsets", type:"field", title:"gun.offsets", text:"properties runtime storage of offsets generated by recoil sway wag or any other element."},
{path:"class/Gun.html#gun.name", type:"field", title:"gun.name", text:"string the name of the gun. Set to __template for guns which have no instances."},
{path:"class/Gun.html#gun.itemstack", type:"field", title:"gun.itemstack", text:"ItemStack itemstack held by the player"},
{path:"class/Gun.html#gun.gun_entity", type:"field", title:"gun.gun_entity", text:"ObjRef the gun entity"},
{path:"class/Gun.html#gun.itemstring", type:"field", title:"gun.itemstring", text:"string the itemstring of the gun- i.e. \"guns4d_pack_1:m4\". Set to \"\" for __template guns."},
{path:"class/Gun.html#gun._registered", type:"field", title:"gun._registered", text:"list of registered guns, *DO NOT MODIFY* I really need a metatable for this class..."},
{path:"class/Gun.html#gun.bolt_charged", type:"field", title:"gun.bolt_charged", text:"bool is the bolt charged"},
{path:"class/Gun.html#gun.particle_spawners", type:"field", title:"gun.particle_spawners", text:"table list of particle spawner handles (generated by firing)"},
{path:"class/Gun.html#gun.current_firemode", type:"field", title:"gun.current_firemode", text:"int the active index of the firemode from lvl1_fields.properties.firemodes"},
{path:"class/Gun.html#gun.walking_tick", type:"field", title:"gun.walking_tick", text:"float walking time used to generate the figure 8 for wag"},
{path:"class/Gun.html#gun.time_since_last_fire", type:"field", title:"gun.time_since_last_fire", text:"float"},
{path:"class/Gun.html#gun.time_since_creation", type:"field", title:"gun.time_since_creation", text:"float"},
{path:"class/Gun.html#gun.rechamber_time", type:"field", title:"gun.rechamber_time", text:"float time left for the chamber to cycle (for firerates)"},
{path:"class/Gun.html#gun.burst_queue", type:"field", title:"gun.burst_queue", text:"int number of rounds left that need to be fired after a burst fire"},
{path:"class/Gun.html#gun.muzzle_flash", type:"field", title:"gun.muzzle_flash", text:"function"},
{path:"class/Gun.html#lvl1_fields.properties.hip", type:"field", title:"lvl1_fields.properties.hip", text:"table hipfire properties"},
{path:"class/Gun.html#lvl1_fields.properties.ads", type:"field", title:"lvl1_fields.properties.ads", text:"table aiming (\"aiming down sights\") properties"},
{path:"class/Gun.html#lvl1_fields.properties.firemodes", type:"field", title:"lvl1_fields.properties.firemodes", text:"table list of firemodes"},
{path:"class/Gun.html#lvl1_fields.properties.firemode_inventory_overlays", type:"field", title:"lvl1_fields.properties.firemode_inventory_overlays", text:"table list of corresponding images for firemodes"},
{path:"class/Gun.html#lvl1_fields.properties.recoil", type:"field", title:"lvl1_fields.properties.recoil", text:"table defines the guns recoil"},
{path:"class/Gun.html#lvl1_fields.properties.sway", type:"field", title:"lvl1_fields.properties.sway", text:"table defines the guns idle sway"},
{path:"class/Gun.html#lvl1_fields.properties.wag", type:"field", title:"lvl1_fields.properties.wag", text:"table defines the movement of the gun while walking"},
{path:"class/Gun.html#lvl1_fields.properties.charging", type:"field", title:"lvl1_fields.properties.charging", text:"table defines how rounds are chambered into the gun"},
{path:"class/Gun.html#lvl1_fields.properties.ammo", type:"field", title:"lvl1_fields.properties.ammo", text:"defines what ammo the gun uses"},
{path:"class/Gun.html#lvl1_fields.properties.visuals", type:"field", title:"lvl1_fields.properties.visuals", text:"defines visual attributes of the gun"},
{path:"class/Gun.html#lvl1_fields.properties.breathing_scale", type:"field", title:"lvl1_fields.properties.breathing_scale", text:"float=.5 max angular deviation (vertical) from breathing"},
{path:"class/Gun.html#lvl1_fields.properties.flash_offset", type:"field", title:"lvl1_fields.properties.flash_offset", text:"vector the offset from the center of the muzzle flash. Used by fire()"},
{path:"class/Gun.html#lvl1_fields.properties.firerateRPM", type:"field", title:"lvl1_fields.properties.firerateRPM", text:"int=600 The number of rounds (cartidges) this gun can throw per minute. Used by update(), fire() and default controls"},
{path:"class/Gun.html#lvl1_fields.properties.item", type:"field", title:"lvl1_fields.properties.item", text:"the item entity's attributes. This will later include held item definition..."},
{path:"class/Gun.html#gun.properties.hip.offset", type:"field", title:"gun.properties.hip.offset", text:"vector the offset of the gun (relative to the right arm's default position) at hip."},
{path:"class/Gun.html#gun.properties.hip.axis_rotation_ratio", type:"field", title:"gun.properties.hip.axis_rotation_ratio", text:"the ratio that the look rotation is expressed through player_axial (rotated around the viewport) rotation as opposed to gun_axial (rotating the entity)."},
{path:"class/Gun.html#gun.properties.hip.sway_vel_mul", type:"field", title:"gun.properties.hip.sway_vel_mul", text:"sway speed multiplier while at hip"},
{path:"class/Gun.html#gun.properties.hip.sway_angle_mul", type:"field", title:"gun.properties.hip.sway_angle_mul", text:"sway angle multiplier while at hip+"},
{path:"class/Gun.html#gun.properties.ads.offset", type:"field", title:"gun.properties.ads.offset", text:"vector the offset of the gun relative to the eye's position at hip."},
{path:"class/Gun.html#gun.properties.ads.horizontal_offset", type:"field", title:"gun.properties.ads.horizontal_offset", text:"float the horizontal offset of the eye when aiming"},
{path:"class/Gun.html#gun.properties.ads.aim_time", type:"field", title:"gun.properties.ads.aim_time", text:"the time it takes to go into full aim"},
{path:"class/Gun.html#lvl1_fields.properties.burst", type:"field", title:"lvl1_fields.properties.burst", text:"int=3 how many rounds in burst using when firemode is at \"burst\""},
{path:"class/Gun.html#gun.properties.firemodes."single"", type:"field", title:"gun.properties.firemodes.\"single\"", text:""},
{path:"class/Gun.html#gun.properties.firemodes."burst"", type:"field", title:"gun.properties.firemodes.\"burst\"", text:""},
{path:"class/Gun.html#gun.properties.firemodes."auto"", type:"field", title:"gun.properties.firemodes.\"auto\"", text:""},
{path:"class/Gun.html#lvl1_fields.properties.infinite_inventory_overlay", type:"field", title:"lvl1_fields.properties.infinite_inventory_overlay", text:"string overlay on the item to use when infinite ammo is on"},
{path:"class/Gun.html#gun.properties.firemode_inventory_overlays.single", type:"field", title:"gun.properties.firemode_inventory_overlays.single", text:"\"inventory_overlay_single.png\""},
{path:"class/Gun.html#gun.properties.firemode_inventory_overlays.auto", type:"field", title:"gun.properties.firemode_inventory_overlays.auto", text:"\"inventory_overlay_auto.png\""},
{path:"class/Gun.html#gun.properties.firemode_inventory_overlays.burst", type:"field", title:"gun.properties.firemode_inventory_overlays.burst", text:"\"inventory_overlay_burst.png\""},
{path:"class/Gun.html#gun.properties.firemode_inventory_overlays.safe", type:"field", title:"gun.properties.firemode_inventory_overlays.safe", text:"\"inventory_overlay_safe.png\" (unimplemented firemode)"},
{path:"class/Gun.html#gun.properties.recoil.velocity_correction_factor", type:"field", title:"gun.properties.recoil.velocity_correction_factor", text:"float TL:DR higher decreases recoil at expense of smoothness. 1/value is the deviation of a normalized bell curve, where x is the time since firing. this means that increasing it decreases the time it takes for the angular velocity to fully \"decay\"."},
{path:"class/Gun.html#gun.properties.recoil.target_correction_factor", type:"field", title:"gun.properties.recoil.target_correction_factor", text:"float Correction of recoil offset per second is calculated as such: target_correction_factor[axis]time_since_firerecoil[axis]"},
{path:"class/Gun.html#gun.properties.recoil.target_correction_max_rate", type:"field", title:"gun.properties.recoil.target_correction_max_rate", text:"float The maximum rate per second of recoil offset as determined with target_correction_factor"},
{path:"class/Gun.html#gun.properties.recoil.angular_velocity_max", type:"field", title:"gun.properties.recoil.angular_velocity_max", text:"float caps the recoil velocity that can stack up from shots."},
{path:"class/Gun.html#gun.properties.recoil.angular_velocity", type:"field", title:"gun.properties.recoil.angular_velocity", text:"vector {x=float, y=float}, defines the initial angular velocity produced by firing the gun"},
{path:"class/Gun.html#gun.properties.recoil.bias", type:"field", title:"gun.properties.recoil.bias", text:"vector {x=float, y=float}, ranges -1 to 1. Defines the probability of the recoil being positive or negative for any given axis."},
{path:"class/Gun.html#gun.properties.recoil.hipfire_multiplier", type:"field", title:"gun.properties.recoil.hipfire_multiplier", text:"float angular velocity multiplier when firing from the hip"},
{path:"class/Gun.html#gun.properties.sway.max_angle", type:"field", title:"gun.properties.sway.max_angle", text:"float maximum angle of the sway"},
{path:"class/Gun.html#gun.properties.sway.angular_velocity", type:"field", title:"gun.properties.sway.angular_velocity", text:"float angular velocity the sway"},
{path:"class/Gun.html#gun.properties.sway.hipfire_angle_multiplier", type:"field", title:"gun.properties.sway.hipfire_angle_multiplier", text:"float maximum angle multiplier while the gun is at the hip"},
{path:"class/Gun.html#gun.properties.sway.hipfire_velocity_multiplier", type:"field", title:"gun.properties.sway.hipfire_velocity_multiplier", text:"float velocity multiplier while the gun is at the hip"},
{path:"class/Gun.html#gun.properties.wag.cycle_speed", type:"field", title:"gun.properties.wag.cycle_speed", text:"float=1.6 the cycle speed multiplier"},
{path:"class/Gun.html#gun.properties.wag.decay_speed", type:"field", title:"gun.properties.wag.decay_speed", text:"float=1 decay factor when walking has stopped and offset remains."},
{path:"class/Gun.html#gun.properties.wag.offset", type:"field", title:"gun.properties.wag.offset", text:"table containing angular deviation while walking in the same format as an offset vector. Acts as a multiplier on the figure-8 generated while walking."},
{path:"class/Gun.html#lvl1_fields.properties.pc_control_actions", type:"field", title:"lvl1_fields.properties.pc_control_actions", text:"table containing a list of actions for PC users passed to Control_handler"},
{path:"class/Gun.html#lvl1_fields.properties.touch_control_actions", type:"field", title:"lvl1_fields.properties.touch_control_actions", text:"table containing a list of actions for touch screen users passed to Control_handler"},
{path:"class/Gun.html#gun.properties.charging.require_draw_on_swap", type:"field", title:"gun.properties.charging.require_draw_on_swap", text:"bool defines wether the draw animation is played on swap (when loaded). Used in the instance construction method"},
{path:"class/Gun.html#gun.properties.charging.bolt_charge_mode", type:"field", title:"gun.properties.charging.bolt_charge_mode", text:"string \"none\" bolt will never need to be charged after reload, \"catch\" when fired to empty bolt will not need to be charged after reload, \"no_catch\" bolt will always need to be charged after reload."},
{path:"class/Gun.html#gun.properties.charging.draw_time", type:"field", title:"gun.properties.charging.draw_time", text:"float the time it takes to swap to the gun"},
{path:"class/Gun.html#gun.properties.charging.draw_animation", type:"field", title:"gun.properties.charging.draw_animation", text:"string name of the animation to play from visuals.animations"},
{path:"class/Gun.html#gun.properties.charging.draw_sound", type:"field", title:"gun.properties.charging.draw_sound", text:"string name of the sound to play from sounds"},
{path:"class/Gun.html#lvl1_fields.properties.reload", type:"field", title:"lvl1_fields.properties.reload", text:"and ordered list of reloading states used by default_controls. the default reload states for a magazine operated weapon, copied from the m4. Example"},
{path:"class/Gun.html#gun.properties.ammo.accepted_bullets", type:"field", title:"gun.properties.ammo.accepted_bullets", text:"table a list of accepted bullet itemstrings"},
{path:"class/Gun.html#gun.properties.ammo.accepted_magazines", type:"field", title:"gun.properties.ammo.accepted_magazines", text:"table a list of accepted magazine itemstrings"},
{path:"class/Gun.html#gun.properties.ammo.initial_mag", type:"field", title:"gun.properties.ammo.initial_mag", text:"string the mag the gun starts with. Set to \"empty\" for no mag, otherwise it defaults to accepted_magazines[1] (if present)"},
{path:"class/Gun.html#gun.properties.visuals.backface_culling", type:"field", title:"gun.properties.visuals.backface_culling", text:"toggles backface culling"},
{path:"class/Gun.html#gun.properties.visuals.animations", type:"field", title:"gun.properties.visuals.animations", text:"a table of animations in the format {x=int, y=float}. Indexes define the name of the animation to be refrenced by other functions of the gun."},
{path:"class/Gun.html#lvl1_fields.properties.sounds", type:"field", title:"lvl1_fields.properties.sounds", text:"a table of soundspecs to be referenced by other functions"},
{path:"class/Gun.html#lvl1_fields.offsets.recoil", type:"field", title:"lvl1_fields.offsets.recoil", text:""},
{path:"class/Gun.html#lvl1_fields.offsets.sway", type:"field", title:"lvl1_fields.offsets.sway", text:""},
{path:"class/Gun.html#lvl1_fields.offsets.walking", type:"field", title:"lvl1_fields.offsets.walking", text:""},
{path:"class/Gun.html#lvl1_fields.offsets.breathing", type:"field", title:"lvl1_fields.offsets.breathing", text:""},
{path:"class/Gun.html#lvl1_fields.offsets.look_snap", type:"field", title:"lvl1_fields.offsets.look_snap", text:""},
{path:"class/Gun.html#gun.animation_rotation", type:"field", title:"gun.animation_rotation", text:"vector containing the offset from animations, this will be generated if {@consts.ANIMATIONS_OFFSET_AIM}=true"},
{path:"class/Gun.html#gun.total_offset_rotation", type:"field", title:"gun.total_offset_rotation", text:"total offsets of the gun in the same format as a an offset"},
{path:"class/Gun.html#lvl1_fields.consts.AIM_OUT_AIM_IN_SPEED_RATIO", type:"field", title:"lvl1_fields.consts.AIM_OUT_AIM_IN_SPEED_RATIO", text:""},
{path:"class/Gun.html#lvl1_fields.consts.KEYFRAME_SAMPLE_PRECISION", type:"field", title:"lvl1_fields.consts.KEYFRAME_SAMPLE_PRECISION", text:"frequency of keyframe samples for animation offsets and"},
{path:"class/Gun.html#lvl1_fields.consts.DEFAULT_MAX_HEAR_DISTANCE", type:"field", title:"lvl1_fields.consts.DEFAULT_MAX_HEAR_DISTANCE", text:"default max hear distance when not specified"},
{path:"class/Gun.html#lvl1_fields.consts.DEFAULT_FPS", type:"field", title:"lvl1_fields.consts.DEFAULT_FPS", text:"fps=60 animation fps i.e. during firing when no length is specified"},
{path:"class/Gun.html#lvl1_fields.consts.HAS_RECOIL", type:"field", title:"lvl1_fields.consts.HAS_RECOIL", text:"bool"},
{path:"class/Gun.html#lvl1_fields.consts.HAS_BREATHING", type:"field", title:"lvl1_fields.consts.HAS_BREATHING", text:"bool"},
{path:"class/Gun.html#lvl1_fields.consts.HAS_SWAY", type:"field", title:"lvl1_fields.consts.HAS_SWAY", text:"bool"},
{path:"class/Gun.html#lvl1_fields.consts.HAS_WAG", type:"field", title:"lvl1_fields.consts.HAS_WAG", text:"bool"},
{path:"class/Gun.html#lvl1_fields.consts.HAS_GUN_AXIAL_OFFSETS", type:"field", title:"lvl1_fields.consts.HAS_GUN_AXIAL_OFFSETS", text:"bool wether the gun rotates on it's own axis instead of the player's view (i.e. ironsight misalignments)"},
{path:"class/Gun.html#lvl1_fields.consts.ANIMATIONS_OFFSET_AIM", type:"field", title:"lvl1_fields.consts.ANIMATIONS_OFFSET_AIM", text:"wether animations create an offset"},
{path:"class/Gun.html#lvl1_fields.consts.LOOP_IDLE_ANIM", type:"field", title:"lvl1_fields.consts.LOOP_IDLE_ANIM", text:"whether the idle animation changes or not"},
{path:"class/Gun.html#lvl1_fields.consts.THIRD_PERSON_GAIN_MULTIPLIER", type:"field", title:"lvl1_fields.consts.THIRD_PERSON_GAIN_MULTIPLIER", text:"general gain multiplier for third persons when hearing sounds"},
{path:"class/Gun.html#lvl1_fields.consts.ROOT_BONE", type:"field", title:"lvl1_fields.consts.ROOT_BONE", text:"the root bone of the gun (for animation offsets)"},
{path:"class/Gun.html#lvl1_fields.consts.MAG_BONE", type:"field", title:"lvl1_fields.consts.MAG_BONE", text:"string=\"magazine\",the bone of the magazine in the gun (for dropping mags)"},
{path:"class/Gun.html#lvl1_fields.consts.ARM_RIGHT_BONE", type:"field", title:"lvl1_fields.consts.ARM_RIGHT_BONE", text:"string=\"right_aimpoint\", the bone which the right arm aims at to"},
{path:"class/Gun.html#lvl1_fields.consts.ARM_LEFT_BONE", type:"field", title:"lvl1_fields.consts.ARM_LEFT_BONE", text:"string=\"left_aimpoint\", the bone which the left arm aims at to"},
{path:"class/Instantiatable_class.html#god_work.instance", type:"field", title:"god_work.instance", text:"defines wether the object is an instance"},
{path:"class/Instantiatable_class.html#god_work.base_class", type:"field", title:"god_work.base_class", text:"only present for instances: the class from which this instance originates"},
{path:"class/Instantiatable_class.html#god_work.parent_class", type:"field", title:"god_work.parent_class", text:"the class from which this class was inherited from"},
{path:"module/misc_helpers.html#Guns4d.math.weighted_randoms", type:"function", title:"Guns4d.math.weighted_randoms", text:"picks a random index, with odds based on it's value. Returns the index of the selected."},
{path:"module/play_sound.html#Guns4d.play_sounds", type:"function", title:"Guns4d.play_sounds", text:"allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions. WARNING: this function modifies the tables passed to it, use Guns4d.table.shallow_copy() or table.copy for inputted soundspecs Example"},
{path:"module/play_sound.html#Guns4d.get_sounds", type:"function", title:"Guns4d.get_sounds", text:"gets a list of currently playing Minetest sound handles from the Guns4d sound handle. Modification of table highly discouraged."},
{path:"module/play_sound.html#Guns4d.stop_sounds", type:"function", title:"Guns4d.stop_sounds", text:"stops a list of sounds"},
{path:"module/Bullet_hole.html#Bullet_hole.construct", type:"function", title:"Bullet_hole.construct", text:""},
{path:"module/Control_handler.html#controls.toggle_touchscreen_mode", type:"function", title:"controls:toggle_touchscreen_mode", text:""},
{path:"class/Instantiatable_class.html#Instantiatable_class.inherit", type:"function", title:"Instantiatable_class:inherit", text:"creates a new base class. Calls all constructors in the chain with def.instance=true"},
{path:"class/Instantiatable_class.html#Instantiatable_class.new", type:"function", title:"Instantiatable_class:new", text:"creates an instance of the base class. Calls all constructors in the chain with def.instance=true"},
{path:"module/Player_model_handler.html#player_model.construct", type:"function", title:"player_model.construct", text:""},
{path:"module/misc_helpers.html#math", type:"section", title:"math helpers", text:"in guns4d.math"},
{path:"module/misc_helpers.html#table", type:"section", title:"table helpers", text:"in guns4d.table"},
{path:"module/misc_helpers.html#other", type:"section", title:"other helpers", text:""},
];

1
docs/out/js-search.min.js vendored Normal file

File diff suppressed because one or more lines are too long

629
docs/out/luadox.css Normal file
View File

@ -0,0 +1,629 @@
:target {
background-color: #ffe080 !important;
color: black !important;
border-bottom: 1px solid #cca940 !important;
border-top: 1px solid #cca940 !important;
}
body {
font-family: sans-serif;
color: black;
padding: 0px;
margin: 0;
}
div.topbar {
box-sizing: border-box;
background-color: #465158;
position: fixed;
display: flex;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 40px;
padding: 0 1em 0 0.4em;
z-index: 10;
font-size: 90%;
color: white;
box-shadow: 0 0px 15px 5px rgba(0, 0, 0, 0.4);
}
div.topbar div.group {
display: flex;
flex: 1;
}
div.topbar div.group.one {
justify-content: flex-start;
}
div.topbar div.group.two {
justify-content: center;
}
div.topbar div.group.three {
justify-content: flex-end;
}
div.topbar a {
color: white;
border: none;
padding: 0.5em 1em;
}
div.topbar div.description a {
font-size: 100% !important;
font-weight: normal !important;
margin-left: 0 !important;
}
div.topbar div.button a {
margin: 0.375em 0;
font-size: 80%;
font-weight: bold;
white-space: nowrap;
display: flex;
align-items: center;
}
div.topbar div.button.solid a {
margin-left: 1em;
}
div.topbar div.button.solid a,
div.topbar div.button a:hover {
background-color: #697983;
text-shadow: 0 1px rgba(0, 0, 0, 0.5);
border-radius: 3px;
border: none;
}
div.topbar div.button.solid a:hover {
background-color: #8aa0ad;
}
div.topbar div.button a img {
width: 1.5em;
}
div.topbar div.button a img[src*='.svg'] {
filter: invert(1);
}
div.topbar div.button.iconleft a {
padding-left: 0.6em;
padding-right: 1em;
}
div.topbar div.button.iconright a {
padding-left: 1em;
padding-right: 0.6em;
}
div.topbar div.button.iconleft a img {
padding-right: 0.5em;
}
div.topbar div.button.iconright a img {
padding-left: 0.5em;
}
div.sidebar {
clear: both;
box-sizing: border-box;
background-color: #e8ecef;
width: 15em;
height: calc(100% - 40px);
padding: 1em 0.5em;
border-right: 1px solid #ccc;
position: fixed;
overflow-y: auto;
}
div.body {
margin-left: 15em;
margin-top: 2.5em;
}
div.sidebar div.heading {
font-weight: bold;
}
div.sidebar ul {
list-style-type: none;
padding-left: 1em;
margin-top: 0.5em;
}
div.sidebar li {
padding: 2px 0;
}
div.sidebar li.selected {
font-weight: bold;
}
div.sidebar div.sections li {
padding-left: 1em;
text-indent: -1em;
}
div.sidebar p,
h2 p {
margin: 0;
padding: 0;
display: inline;
}
a {
color: #444;
text-decoration: none;
border-bottom: 1px solid #ccc;
}
a:hover {
color: #000;
border-bottom: 1px solid #666;
}
div.section, div.body div.manual {
padding: 0em 1em 1em 1em;
}
div.body pre {
margin: 0 2em;
}
div.manual h1 {
margin: 0 -16px 0 -20px;
padding: 10px 10px 10px 20px;
font-size: 120%;
}
div.section h2 {
margin: 0 -16px 0 -20px;
padding: 10px 10px 10px 20px;
background-color: #eeeeee;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
font-size: 120%;
}
div.manual h2,
div.manual h3 {
margin: 1em -16px 0 -20px;
padding: 10px 10px 10px 20px;
}
div.manual h2 {
background-color: #eeeeee;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
font-size: 120%;
padding: 10px 10px 10px 20px;
}
div.manual h3 {
font-size: 110%;
padding: 5px 5px 5px 20px;
/* Ensures when :target applies (which adds borders) we don't affect layout */
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
}
div.hierarchy {
margin-top: 2em;
margin-bottom: 2em;
}
div.hierarchy div.heading {
font-weight: bold;
margin-bottom: 0.5em;
}
div.hierarchy ul {
margin-top: 0.5em;
padding-left: 1em;
}
div.hierarchy li {
list-style-type: none;
margin: 0.4em 0;
}
div.hierarchy li span {
padding: 0.2em;
font-family: "Consolas", "Deja Vu Sans Mono", "Bitstream Vera Sans Mono", monospace;
font-size: 0.95em;
letter-spacing: 0.01em;
}
div.hierarchy li span em {
font-style: normal;
}
div.hierarchy li.self span {
background-color: #fbedc3;
}
h1,
div.section h2.class,
div.section h2.module {
color: white;
background-color: #555;
border-top: 1px solid #222;
border-bottom: 1px solid #222;
font-size: 140%;
}
code {
font-family: 'Courier New', monospace;
font-size: 0.95em;
}
var, a code {
letter-spacing: 0.01em;
font-weight: bold;
font-style: normal;
color: #444;
}
div.see::before {
content: "👉 ";
}
h3.fields, h3.functions {
padding-top: 1em;
padding-bottom: 0.5em !important;
}
dl p:first-child {
margin-top: 0.5em;
}
dl dd:not(:last-child),
dl dd:not(:last-child) {
padding-bottom: 1.5em;
/*border-bottom: 1px solid #ddd;*/
}
dt {
padding: 0.5em;
margin-left: -1em;
margin-right: -1em;
/* Ensures when :target applies (which adds borders) we don't affect layout */
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
}
dt var {
font-size: 1.15em;
}
dd {
margin-left: 2.5em;
}
dl.functions div.heading {
margin-top: 1em;
margin-left: 0em;
margin-bottom: 0.5em;
font-style: italic;
}
table.parameters,
table.returns {
max-width: 90%;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
border-left: transparent;
border-right: transparent;
margin-left: 1em;
border-collapse: collapse;
}
table.parameters td,
table.returns td {
padding: 0.4em 0;
vertical-align: top;
}
table.parameters tr:not(:last-child) td,
table.returns tr:not(:last-child) td {
border-bottom: 1px solid #ccc;
}
table.parameters tr,
table.returns tr {
background: #f7f7f7;
}
table.parameters tr td:first-child,
table.returns tr td:first-child {
text-align: right;
padding-left: 1em;
}
table.parameters tr td:last-child,
table.returns tr td:last-child {
padding-right: 1em;
}
table.parameters td.name,
table.parameters td.types,
table.returns td.name,
table.returns td.types {
white-space: nowrap;
padding-right: 1em !important;
}
* {
scroll-padding-top: 40px;
}
div.section div.inner {
min-width: 20em;
max-width: 80em;
}
div.synopsis h3 {
display: none;
}
div.synopsis div.heading {
font-weight: bold;
margin-top: 1em;
margin-bottom: 0em;
margin-left: 0.5em;
}
div.synopsis table {
border-top: 1px solid #d2b089;
border-bottom: 1px solid #d2b089;
background-color: #f8f0e6;
width: 95%;
margin: 1em auto;
border-collapse: collapse;
}
div.synopsis td {
padding: 0.3em 0.5em 0.3em 0.5em;
vertical-align: top;
}
div.synopsis tr:not(:last-child) td {
border-bottom: 1px solid #e2d0ba;
}
div.synopsis td:first-child {
/* min-width: 15em;
max-width: 20em; */
white-space: nowrap;
padding-right: 1em;
}
div.synopsis td.meta,
div.synopsis td.meta a {
white-space: nowrap;
color: #777777;
}
div.synopsis td > p,
table.parameters td > p,
table.returns td > p {
margin: 0;
}
div.synopsis td > p:not(:first-child) {
margin-top: 0.5em;
}
div.synopsis td a.permalink {
color: #aaa;
}
div.admonition {
border: 1px solid #609060;
background-color: #e9ffe9;
width: 90%;
margin: 1.5em auto;
}
div.admonition div.title {
margin: 0;
margin-top: 0px;
padding: 0.3em 0 0.3em 0.5em;
color: white;
font-weight: bold;
font-size: 1.0em;
text-shadow: 0 1px rgba(0, 0, 0, 0.5);
}
div.admonition div.body {
margin: 0.5em 1em 0.5em 1em;
padding: 0;
}
div.warning {
border: 1px solid #900000;
background-color: #ffe9e9;
}
div.warning div.title {
background-color: #b04040;
border-bottom: 1px solid #900000;
}
div.note div.title {
background-color: #70A070;
border-bottom: 1px solid #609060;
}
dl.fields dt span.icon::after {
content: "🏷️ ";
vertical-align: middle;
font-size: 110%;
}
dl.fields dt span.tag,
dl.functions dt span.tag {
border-radius: 20px;
border: 1px solid #ccc;
background-color: #eee;
display: inline;
opacity: 0.6;
padding: 5px 10px;
font-size: 80%;
margin: 0 0.5em;
}
dl.fields dt span.tag:first-of-type,
dl.functions dt span.tag:first-of-type {
margin-left: 2em;
}
dl.fields dt span.meta::before,
dl.functions dt span.meta::before {
filter: saturate(0);
opacity: 0.9;
content: "👁️";
padding-right: 0.5em;
}
dl.fields dt span.type::before {
filter: saturate(0);
opacity: 0.9;
content: "✏️";
padding-right: 0.5em;
}
dl.functions dt span.icon::after {
content: "🏃‍♂️ ";
vertical-align: middle;
font-size: 140%;
}
a.permalink:hover {
color: #c60f0f !important;
border: none;
}
a.permalink {
color: #ccc;
font-size: 1em;
margin-left: 6px;
padding: 0 4px 0 4px;
text-decoration: none;
border: none;
visibility: hidden;
}
h1:hover > a.permalink,
h2:hover > a.permalink,
h3:hover > a.permalink,
h4:hover > a.permalink,
td:hover > a.permalink,
td:hover > div > a.permalink,
dt:hover > a.permalink {
visibility: visible;
}
pre.language-lua {
border-radius: 6px;
}
dd table {
}
input.search {
width: calc(100% - 2.5em);
opacity: 0.7;
margin: 0 1em 1em 1em;
}
input.search:focus {
opacity: 1.0;
}
div#template {
display: none;
}
div#results {
padding: 1em;
max-width: 650px;
}
div.result {
margin-bottom: 35px;
font-family: arial, sans-serif;
}
div.result div.title {
font-size: 20px;
line-height: 1.3;
}
div.result div.text {
line-height: 1.58;
margin-left: 2em;
}
div.summary {
color: #666666;
font-size: 90%;
margin-bottom: 1em;
}
div.result span {
font-size: 90%;
}
div.result.result-class span::after {
content: "🧱 ";
}
div.result.result-module span::after {
content: "📦 ";
}
div.result.result-field span::after {
content: "🏷️ ";
}
div.result.result-function span::after {
content: "🏃‍♂️ ";
}
div.result.result-section span::after {
content: "📓 ";
}
div.result b {
background-color: #faffb8;
}
table.user {
border-collapse: collapse;
margin: 1em;
font-family: sans-serif;
min-width: 400px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
border-radius: 10px;
border-collapse: collapse;
overflow: hidden;
}
table.user thead tr {
background-color: #3a5e75;
color: #ffffff;
text-align: left;
}
table.user th,
table.user td {
padding: 12px 15px;
}
table.user tbody tr {
border-bottom: 1px solid #dddddd;
}
table.user tbody tr:nth-of-type(even) {
background-color: #f3f3f3;
}
table.user tbody tr:last-of-type {
border-bottom: 3px solid #3a5e75;
}

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Bullet_hole - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head>
<body class="module-bullet_hole">
<div class="topbar">
<div class="group one">
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
</div>
<div class="group two">
</div>
<div class="group three">
<div class="button iconleft"><a href="../module/play_sound.html" title="play_sound"><img src="../img/i-left.svg?7653a2d" alt=""/><span>Previous</span></a></div>
<div class="button iconright"><a href="../module/Control_handler.html" title="Control_handler"><span>Next</span><img src="../img/i-right.svg?7653a2d" alt=""/></a></div>
</div>
</div>
<div class="sidebar">
<form action="../search.html">
<input class="search" name="q" type="search" placeholder="Search" />
</form>
<div class="sections">
<div class="heading">Contents</div>
<ul>
<li><a href="#Bullet_hole">Module <code>Bullet_hole</code></a></li>
</ul>
</div>
<div class="classes">
<div class="heading">Classes</div>
<ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/Instantiatable_class.html">Instantiatable_class.Instantiatable_class</a></li>
</ul>
</div>
<div class="modules">
<div class="heading">Modules</div>
<ul>
<li><a href="../module/misc_helpers.html">misc_helpers</a></li>
<li><a href="../module/play_sound.html">play_sound</a></li>
<li class="selected"><a href="../module/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="../module/Control_handler.html">Control_handler</a></li>
<li><a href="../module/Player_model_handler.html">Player_model_handler</a></li>
</ul>
</div>
</div>
<div class="body">
<div class="section">
<h2 class="module" id="Bullet_hole">Module <code>Bullet_hole</code>
<a class="permalink" href="#Bullet_hole" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<h3>Synopsis</h3>
<div class="heading">Functions</div>
<table class="functions ">
<tr>
<td class="name"><a href="#Bullet_hole.construct"><var>Bullet_hole.construct</var></a>()</td>
<td class="doc"></td>
</tr>
</table>
</div>
<dl class="functions">
<dt id="Bullet_hole.construct">
<span class="icon"></span><var>Bullet_hole.construct</var>(<em>def</em>)
<a class="permalink" href="#Bullet_hole.construct" title="Permalink to this definition"></a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
<script src="../prism.js?7653a2d"></script>
</body>
</html>

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Control_handler - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head>
<body class="module-control_handler">
<div class="topbar">
<div class="group one">
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
</div>
<div class="group two">
</div>
<div class="group three">
<div class="button iconleft"><a href="../module/Bullet_hole.html" title="Bullet_hole"><img src="../img/i-left.svg?7653a2d" alt=""/><span>Previous</span></a></div>
<div class="button iconright"><a href="../module/Player_model_handler.html" title="Player_model_handler"><span>Next</span><img src="../img/i-right.svg?7653a2d" alt=""/></a></div>
</div>
</div>
<div class="sidebar">
<form action="../search.html">
<input class="search" name="q" type="search" placeholder="Search" />
</form>
<div class="sections">
<div class="heading">Contents</div>
<ul>
<li><a href="#Control_handler">Module <code>Control_handler</code></a></li>
</ul>
</div>
<div class="classes">
<div class="heading">Classes</div>
<ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/Instantiatable_class.html">Instantiatable_class.Instantiatable_class</a></li>
</ul>
</div>
<div class="modules">
<div class="heading">Modules</div>
<ul>
<li><a href="../module/misc_helpers.html">misc_helpers</a></li>
<li><a href="../module/play_sound.html">play_sound</a></li>
<li><a href="../module/Bullet_hole.html">Bullet_hole</a></li>
<li class="selected"><a href="../module/Control_handler.html">Control_handler</a></li>
<li><a href="../module/Player_model_handler.html">Player_model_handler</a></li>
</ul>
</div>
</div>
<div class="body">
<div class="section">
<h2 class="module" id="Control_handler">Module <code>Control_handler</code>
<a class="permalink" href="#Control_handler" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<h3>Synopsis</h3>
<div class="heading">Functions</div>
<table class="functions ">
<tr>
<td class="name"><a href="#controls.toggle_touchscreen_mode"><var>controls:toggle_touchscreen_mode</var></a>()</td>
<td class="doc"></td>
</tr>
</table>
</div>
<dl class="functions">
<dt id="controls.toggle_touchscreen_mode">
<span class="icon"></span><var>controls:toggle_touchscreen_mode</var>(<em>active</em>)
<a class="permalink" href="#controls.toggle_touchscreen_mode" title="Permalink to this definition"></a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
<script src="../prism.js?7653a2d"></script>
</body>
</html>

View File

@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en">
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Player_model_handler - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head>
<body class="module-player_model_handler">
<div class="topbar">
<div class="group one">
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
</div>
<div class="group two">
</div>
<div class="group three">
<div class="button iconleft"><a href="../module/Control_handler.html" title="Control_handler"><img src="../img/i-left.svg?7653a2d" alt=""/><span>Previous</span></a></div>
</div>
</div>
<div class="sidebar">
<form action="../search.html">
<input class="search" name="q" type="search" placeholder="Search" />
</form>
<div class="sections">
<div class="heading">Contents</div>
<ul>
<li><a href="#Player_model_handler">Module <code>Player_model_handler</code></a></li>
</ul>
</div>
<div class="classes">
<div class="heading">Classes</div>
<ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/Instantiatable_class.html">Instantiatable_class.Instantiatable_class</a></li>
</ul>
</div>
<div class="modules">
<div class="heading">Modules</div>
<ul>
<li><a href="../module/misc_helpers.html">misc_helpers</a></li>
<li><a href="../module/play_sound.html">play_sound</a></li>
<li><a href="../module/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="../module/Control_handler.html">Control_handler</a></li>
<li class="selected"><a href="../module/Player_model_handler.html">Player_model_handler</a></li>
</ul>
</div>
</div>
<div class="body">
<div class="section">
<h2 class="module" id="Player_model_handler">Module <code>Player_model_handler</code>
<a class="permalink" href="#Player_model_handler" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<div class="synopsis">
<h3>Synopsis</h3>
<div class="heading">Functions</div>
<table class="functions ">
<tr>
<td class="name"><a href="#player_model.construct"><var>player_model.construct</var></a>()</td>
<td class="doc"></td>
</tr>
</table>
</div>
<dl class="functions">
<dt id="player_model.construct">
<span class="icon"></span><var>player_model.construct</var>(<em>def</em>)
<a class="permalink" href="#player_model.construct" title="Permalink to this definition"></a>
</dt>
<dd>
</dd>
</dl>
</div>
</div>
</div>
<script src="../prism.js?7653a2d"></script>
</body>
</html>

View File

@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="en">
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>misc_helpers - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head>
<body class="module-misc_helpers">
<div class="topbar">
<div class="group one">
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
</div>
<div class="group two">
</div>
<div class="group three">
<div class="button iconleft"><a href="../class/Instantiatable_class.html" title="Instantiatable_class"><img src="../img/i-left.svg?7653a2d" alt=""/><span>Previous</span></a></div>
<div class="button iconright"><a href="../module/play_sound.html" title="play_sound"><span>Next</span><img src="../img/i-right.svg?7653a2d" alt=""/></a></div>
</div>
</div>
<div class="sidebar">
<form action="../search.html">
<input class="search" name="q" type="search" placeholder="Search" />
</form>
<div class="sections">
<div class="heading">Contents</div>
<ul>
<li><a href="#misc_helpers">Module <code>misc_helpers</code></a></li>
<li><a href="#math"><p>math helpers</p>
</a></li>
<li><a href="#table"><p>table helpers</p>
</a></li>
<li><a href="#other"><p>other helpers</p>
</a></li>
</ul>
</div>
<div class="classes">
<div class="heading">Classes</div>
<ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/Instantiatable_class.html">Instantiatable_class.Instantiatable_class</a></li>
</ul>
</div>
<div class="modules">
<div class="heading">Modules</div>
<ul>
<li class="selected"><a href="../module/misc_helpers.html">misc_helpers</a></li>
<li><a href="../module/play_sound.html">play_sound</a></li>
<li><a href="../module/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="../module/Control_handler.html">Control_handler</a></li>
<li><a href="../module/Player_model_handler.html">Player_model_handler</a></li>
</ul>
</div>
</div>
<div class="body">
<div class="section">
<h2 class="module" id="misc_helpers">Module <code>misc_helpers</code>
<a class="permalink" href="#misc_helpers" title="Permalink to this definition"></a>
</h2>
<div class="inner">
</div>
</div>
<div class="section">
<h2 class="section" id="math">math helpers
<a class="permalink" href="#math" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>in guns4d.math</p>
<div class="synopsis">
<h3>Synopsis</h3>
<div class="heading">Functions</div>
<table class="functions ">
<tr>
<td class="name"><a href="#Guns4d.math.weighted_randoms"><var>Guns4d.math.weighted_randoms</var></a>()</td>
<td class="doc"><p>picks a random index, with odds based on it's value</p>
</td>
</tr>
</table>
</div>
<dl class="functions">
<dt id="Guns4d.math.weighted_randoms">
<span class="icon"></span><var>Guns4d.math.weighted_randoms</var>(<em>tbl</em>)
<a class="permalink" href="#Guns4d.math.weighted_randoms" title="Permalink to this definition"></a>
</dt>
<dd>
<p>picks a random index, with odds based on it's value. Returns the index of the selected.</p>
</dd>
</dl>
</div>
</div>
<div class="section">
<h2 class="section" id="table">table helpers
<a class="permalink" href="#table" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>in guns4d.table</p>
</div>
</div>
<div class="section">
<h2 class="section" id="other">other helpers
<a class="permalink" href="#other" title="Permalink to this definition"></a>
</h2>
<div class="inner">
</div>
</div>
</div>
<script src="../prism.js?7653a2d"></script>
</body>
</html>

View File

@ -0,0 +1,246 @@
<!DOCTYPE html>
<html lang="en">
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>play_sound - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head>
<body class="module-play_sound">
<div class="topbar">
<div class="group one">
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
</div>
<div class="group two">
</div>
<div class="group three">
<div class="button iconleft"><a href="../module/misc_helpers.html" title="misc_helpers"><img src="../img/i-left.svg?7653a2d" alt=""/><span>Previous</span></a></div>
<div class="button iconright"><a href="../module/Bullet_hole.html" title="Bullet_hole"><span>Next</span><img src="../img/i-right.svg?7653a2d" alt=""/></a></div>
</div>
</div>
<div class="sidebar">
<form action="../search.html">
<input class="search" name="q" type="search" placeholder="Search" />
</form>
<div class="sections">
<div class="heading">Contents</div>
<ul>
<li><a href="#play_sound">Module <code>play_sound</code></a></li>
<li><a href="#guns4d_soundspec"><p>Guns4d soundspec</p>
</a></li>
</ul>
</div>
<div class="classes">
<div class="heading">Classes</div>
<ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/Instantiatable_class.html">Instantiatable_class.Instantiatable_class</a></li>
</ul>
</div>
<div class="modules">
<div class="heading">Modules</div>
<ul>
<li><a href="../module/misc_helpers.html">misc_helpers</a></li>
<li class="selected"><a href="../module/play_sound.html">play_sound</a></li>
<li><a href="../module/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="../module/Control_handler.html">Control_handler</a></li>
<li><a href="../module/Player_model_handler.html">Player_model_handler</a></li>
</ul>
</div>
</div>
<div class="body">
<div class="section">
<h2 class="module" id="play_sound">Module <code>play_sound</code>
<a class="permalink" href="#play_sound" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>implements tools for quickly playing audio.</p>
<div class="synopsis">
<h3>Synopsis</h3>
<div class="heading">Functions</div>
<table class="functions ">
<tr>
<td class="name"><a href="#Guns4d.play_sounds"><var>Guns4d.play_sounds</var></a>()</td>
<td class="doc"><p>allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions</p>
</td>
</tr>
<tr>
<td class="name"><a href="#Guns4d.get_sounds"><var>Guns4d.get_sounds</var></a>()</td>
<td class="doc"><p>gets a list of currently playing Minetest sound handles from the Guns4d sound handle</p>
</td>
</tr>
<tr>
<td class="name"><a href="#Guns4d.stop_sounds"><var>Guns4d.stop_sounds</var></a>()</td>
<td class="doc"><p>stops a list of sounds</p>
</td>
</tr>
</table>
</div>
<dl class="functions">
<dt id="Guns4d.play_sounds">
<span class="icon"></span><var>Guns4d.play_sounds</var>(<em>soundspecs_list</em>)
<a class="permalink" href="#Guns4d.play_sounds" title="Permalink to this definition"></a>
</dt>
<dd>
<p>allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions.</p>
<p>WARNING: this function modifies the tables passed to it, use <code>Guns4d.table.shallow_copy()</code> or <code>table.copy</code> for inputted soundspecs</p>
<h5>Example</h5>
<pre><code class="language-lua">{
to_player = &quot;singeplayer&quot;,
min_distance = 100, --soundspec_to_play1 &amp; soundspec_to_play2 will share this field as it is in the higher level table (as well as the above field)
soundspec_to_play1, --a sound parameter table
soundspec_to_play2
}
</code></pre>
<div class="heading">Parameters</div>
<table class="parameters">
<tr>
<td class="name"><var>soundspecs_list</var></td>
<td class="types">(<em><a href="../module/misc_helpers.html#table">table</a></em>)</td>
<td class="doc"><p>a list a list of soundspecs optionally accompanied with fields to be used in all of them.</p>
</td>
</tr>
</table>
<div class="heading">Return Values</div>
<table class="returns">
<tr>
<td class="types">(<em>integer</em>)</td>
<td class="doc"><p>guns4d sound handle, used by stop_sounds &amp; get_sounds</p>
</td>
</tr>
</table>
</dd>
<dt id="Guns4d.get_sounds">
<span class="icon"></span><var>Guns4d.get_sounds</var>(<em>handle</em>)
<a class="permalink" href="#Guns4d.get_sounds" title="Permalink to this definition"></a>
</dt>
<dd>
<p>gets a list of currently playing Minetest sound handles from the Guns4d sound handle. Modification of table highly discouraged.</p>
<div class="heading">Parameters</div>
<table class="parameters">
<tr>
<td class="name"><var>handle</var></td>
<td class="types">(<em>integer</em>)</td>
<td class="doc"><p>a sound handle as returned by play_sounds</p>
</td>
</tr>
</table>
<div class="heading">Return Values</div>
<table class="returns">
<tr>
<td class="types">(<em><a href="../module/misc_helpers.html#table">table</a></em>)</td>
<td class="doc"><p>a list of sound handles as returned by minetest.sound_play()</p>
</td>
</tr>
</table>
</dd>
<dt id="Guns4d.stop_sounds">
<span class="icon"></span><var>Guns4d.stop_sounds</var>(<em>handle</em>)
<a class="permalink" href="#Guns4d.stop_sounds" title="Permalink to this definition"></a>
</dt>
<dd>
<p>stops a list of sounds</p>
<div class="heading">Parameters</div>
<table class="parameters">
<tr>
<td class="name"><var>handle</var></td>
<td class="types">(<em>integer</em> or <em><a href="../module/misc_helpers.html#table">table</a></em>)</td>
<td class="doc"><p>a guns4d sound handle OR list of minetest sound handles to stop</p>
</td>
</tr>
</table>
<div class="heading">Return Values</div>
<table class="returns">
<tr>
<td class="types">(<em>bool</em>)</td>
<td class="doc"><p>returns true if successful.</p>
</td>
</tr>
</table>
</dd>
</dl>
</div>
</div>
<div class="section">
<h2 class="table" id="guns4d_soundspec">Guns4d soundspec
<a class="permalink" href="#guns4d_soundspec" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>simple specification for playing a sound in relation to an action, acts as a layer of minetest.play_sound.
ATTENTION: read lua_api.md for more parameters! all parameters from there are valid unless otherwise stated here, these are auxillary.</p>
<h5>Example</h5>
<pre><code class="language-lua">soundspec = {
sounds = { --weighted randoms
fire_fp = .5.
fire_fp_2 = .2.
fire_fp_3 = .3
},
pitch = {
min = .6,
max = 1
},
gain = 1, --format for pitch and gain is interchangable.
min_hear_distance = 20, --this is for distant gunshots, for example. Entirely optional. Cannot be used with to_player
exclude_player
to_player
--when present it automatically plays positionless audio, as this is for first person effects.
}
</code></pre>
<div class="synopsis">
<table class="fields compact">
<tr>
<td class="name"><var id="guns4d_soundspec.min_hear_distance">min_hear_distance</var><a class="permalink" href="#guns4d_soundspec.min_hear_distance" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> this is useful if you wish to play a sound which has a &quot;far&quot; sound, such as distant gunshots. incompatible <code>with to_player</code></p>
</td>
</tr>
<tr>
<td class="name"><var id="guns4d_soundspec.sounds">sounds</var><a class="permalink" href="#guns4d_soundspec.sounds" title="Permalink to this definition"></a></td>
<td class="doc"><p><a href="../module/misc_helpers.html#table"><code>table</code></a> a weighted_randoms table for randomly selecting sounds. The output will overwrite the <code>sound</code> field.</p>
</td>
</tr>
<tr>
<td class="name"><var id="guns4d_soundspec.to_player">to_player</var><a class="permalink" href="#guns4d_soundspec.to_player" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>objRef</code> 4dguns changes <a href="../module/play_sound.html#guns4d_soundspec.to_player"><code>to_player</code></a> so it only plays positionless audio (as it is only intended for first person audio). If set to string &quot;from_player&quot; and player present</p>
</td>
</tr>
<tr>
<td class="name"><var id="guns4d_soundspec.player">player</var><a class="permalink" href="#guns4d_soundspec.player" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>objRef</code> this is so to_player being set to &quot;from_player&quot;. It's to be set to the player which fired the weapon.</p>
</td>
</tr>
<tr>
<td class="name"><var id="guns4d_soundspec.delay">delay</var><a class="permalink" href="#guns4d_soundspec.delay" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> delays the playing of the sound</p>
</td>
</tr>
<tr>
<td class="name"><var id="guns4d_soundspec.attenuation_rate">attenuation_rate</var><a class="permalink" href="#guns4d_soundspec.attenuation_rate" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> the rate of dropoff for a sound. I figure this is a bit more intuitive then jacking the gain up super high for every sound... Set the default in config.</p>
</td>
</tr>
<tr>
<td class="name"><var id="guns4d_soundspec.split_audio_by_perspective">split_audio_by_perspective</var><a class="permalink" href="#guns4d_soundspec.split_audio_by_perspective" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>bool</code> [GUN CLASS SPECIFIC] tells the gun wether to split into third and first person (positionless) audio and adjust gain.</p>
</td>
</tr>
<tr>
<td class="name"><var id="guns4d_soundspec.third_person_gain_multiplier">third_person_gain_multiplier</var><a class="permalink" href="#guns4d_soundspec.third_person_gain_multiplier" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>float</code> [GUN CLASS SPECIFIC] replaces the constant/config value &quot;third_person_gain_multiplier/THIRD_PERSON_GAIN_MULTIPLIER&quot;.</p>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<script src="../prism.js?7653a2d"></script>
</body>
</html>

125
docs/out/prism.css Normal file
View File

@ -0,0 +1,125 @@
/* PrismJS 1.24.1
https://prismjs.com/download.html#themes=prism-tomorrow&languages=lua */
/**
* prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML
* Based on https://github.com/chriskempson/tomorrow-theme
* @author Rose Pritchard
*/
code[class*="language-"],
pre[class*="language-"] {
color: #ccc;
background: none;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 1em;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #2d2d2d;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.block-comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #999;
}
.token.punctuation {
color: #ccc;
}
.token.tag,
.token.attr-name,
.token.namespace,
.token.deleted {
color: #e2777a;
}
.token.function-name {
color: #6196cc;
}
.token.boolean,
.token.number,
.token.function {
color: #f08d49;
}
.token.property,
.token.class-name,
.token.constant,
.token.symbol {
color: #f8c555;
}
.token.selector,
.token.important,
.token.atrule,
.token.keyword,
.token.builtin {
color: #cc99cd;
}
.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.variable {
color: #7ec699;
}
.token.operator,
.token.entity,
.token.url {
color: #67cdcc;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
.token.inserted {
color: green;
}

4
docs/out/prism.js Normal file

File diff suppressed because one or more lines are too long

55
docs/out/search.html Normal file
View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<!-- Documentation generated by LuaDox: https://github.com/jtackaberry/luadox -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Search - Guns4d</title>
<link href="prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="luadox.css?7653a2d" type="text/css">
</head>
<body class="search-search">
<div class="topbar">
<div class="group one">
<div class="description"><span>Guns4d | The ultimate 3d gun mod.</span></div>
</div>
<div class="group two">
</div>
<div class="group three">
<div class="button iconright"><a href="class/Instantiatable_class.html" title="Instantiatable_class"><span>Next</span><img src="img/i-right.svg?7653a2d" alt=""/></a></div>
</div>
</div>
<div class="sidebar">
<form action="search.html">
<input class="search" name="q" type="search" placeholder="Search" />
</form>
<div class="classes">
<div class="heading">Classes</div>
<ul>
<li><a href="class/Gun.html">Gun.Gun</a></li>
<li><a href="class/Instantiatable_class.html">Instantiatable_class.Instantiatable_class</a></li>
</ul>
</div>
<div class="modules">
<div class="heading">Modules</div>
<ul>
<li><a href="module/misc_helpers.html">misc_helpers</a></li>
<li><a href="module/play_sound.html">play_sound</a></li>
<li><a href="module/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="module/Control_handler.html">Control_handler</a></li>
<li><a href="module/Player_model_handler.html">Player_model_handler</a></li>
</ul>
</div>
</div>
<div class="body">
<div id="template" class="result"><div class="title"><span></span><a href=""></a></div><div class="text"></div></div>
<div id="results">
<noscript>⛔ Javascript is required for search functionality.</noscript>
<div class="summary"></div>
<script src="js-search.min.js?7653a2d"></script>
<script src="index.js?7653a2d"></script>
<script src="search.js?7653a2d"></script>
</div>
<script src="prism.js?7653a2d"></script>
</body>
</html>

48
docs/out/search.js Normal file
View File

@ -0,0 +1,48 @@
document.addEventListener("DOMContentLoaded", function() {
var template = document.getElementById('template');
var body = document.getElementById('results');
var params = new URLSearchParams(window.location.search);
var q = params.get('q');
if (!q) {
return;
}
var jss = new JsSearch.Search('title');
jss.tokenizer = new JsSearch.StopWordsTokenizer(new JsSearch.SimpleTokenizer());
jss.addIndex('title');
jss.addIndex('text');
jss.addDocuments(docs);
var results = jss.search(q);
var summary = document.getElementsByClassName('summary')[0];
summary.innerHTML = results.length + ' results found for "<i>' + q + '</i>"';
var words = q.split(' ');
for (var i = 0; i < results.length; i++) {
var result = results[i];
var clone = template.cloneNode(true);
clone.removeAttribute('id');
clone.classList.add("result-" + result.type);
var title = clone.childNodes[0];
var icon = title.childNodes[0];
var link = title.childNodes[1];
var text = result.text;
var title = result.title;
if (text.length > 200) {
text = text.slice(0, 210);
var n = text.lastIndexOf(' ');
if (n >= 0) {
text = text.slice(0, n);
}
text = text + '&nbsp;...';
}
// Bold search terms from text
for (var j = 0; j < words.length; j++) {
text = text.replace(new RegExp('(' + words[j] + ')', 'i'), '<b>$1</b>');
title = title.replace(new RegExp('(' + words[j] + ')', 'i'), '<b>$1</b>');
}
icon.setAttribute('title', result.type);
link.setAttribute('href', result.path);
link.innerHTML = title + (result.type == 'function' ? "()" : "");
var desc = clone.childNodes[1];
desc.innerHTML = text;
body.appendChild(clone);
}
});

View File

@ -1,196 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>4dguns</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Tables">Tables</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
<li><strong>Gun</strong></li>
<li><a href="../classes/Instantiatable_class.html">Instantiatable_class</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/classes.player_model_handler.html">classes.player_model_handler</a></li>
<li><a href="../modules/default_controls.html">default_controls</a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="../scripts/item_entities.lua.html">item_entities.lua</a></li>
<li><a href="../scripts/misc_helpers.html">misc_helpers</a></li>
<li><a href="../scripts/play_sound.html">play_sound</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Class <code>Gun</code></h1>
<p>Gun class</p>
<p>
</p>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#gun.properties">gun.properties</a></td>
<td class="summary">properties
the table containing every attribute of the gun.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#gun.offsets">gun.offsets</a></td>
<td class="summary">offsets</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "gun.properties"></a>
<strong>gun.properties</strong>
</dt>
<dd>
properties
the table containing every attribute of the gun.
<h3>Fields:</h3>
<ul>
<li><span class="parameter">infinite_inventory_overlay</span>
defines the filename to to be used as the overlay on the item when the player has infinite ammo.
</li>
<li><span class="parameter">breathing_scale</span>
the max angluler offset caused by breathing.
</li>
<li><span class="parameter">flash_offset</span>
used by fire() (for fsx and ray start pos) [RENAME NEEDED]
</li>
<li><span class="parameter">firerateRPM</span>
used by update() and by extent fire() + default controls. The firerate of the gun. Rounds per minute
</li>
<li><span class="parameter">burst</span>
how many rounds in burst using when firemode is at "burst"
</li>
<li><span class="parameter">ammo_handler</span>
</li>
<li><span class="parameter">item</span>
</li>
<li><span class="parameter">-</span>
</li>
<li><span class="parameter">-</span>
</li>
<li><span class="parameter">.</span>
</li>
<li><span class="parameter">.</span>
</li>
<li><span class="parameter">.</span>
</li>
</ul>
</dd>
<dt>
<a name = "gun.offsets"></a>
<strong>gun.offsets</strong>
</dt>
<dd>
offsets
<h3>Fields:</h3>
<ul>
<li><span class="parameter">recoil</span>
</li>
<li><span class="parameter">player_axial</span>
move<em>dynamic</em>crosshair = false, this would make the dynamic crosshair move instead of get larger
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-06-18 17:20:58 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,202 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>4dguns</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Tables">Tables</a></li>
<li><a href="#Methods">Methods</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
<li><a href="../classes/Gun.html">Gun</a></li>
<li><strong>Instantiatable_class</strong></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/classes.player_model_handler.html">classes.player_model_handler</a></li>
<li><a href="../modules/default_controls.html">default_controls</a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="../scripts/item_entities.lua.html">item_entities.lua</a></li>
<li><a href="../scripts/misc_helpers.html">misc_helpers</a></li>
<li><a href="../scripts/play_sound.html">play_sound</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Class <code>Instantiatable_class</code></h1>
<p>Instantiatable_class.</p>
<p> The system for defining classes in 4dguns. Please note the capital "I", Ldoc converts it to a lowercase in all of this file</p>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#instantiatable_class.god_work">instantiatable_class.god_work</a></td>
<td class="summary">Instantiatable_class</td>
</tr>
</table>
<h2><a href="#Methods">Methods</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#instantiatable_class:inherit">instantiatable_class:inherit (def)</a></td>
<td class="summary">creates a new base class.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#instantiatable_class:construct">instantiatable_class:construct ()</a></td>
<td class="summary">construct
every parent constructor is called in order of inheritance, this is used to make changes to the child table.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#instantiatable_class:new">instantiatable_class:new ()</a></td>
<td class="summary">creates an instance of the base class.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "instantiatable_class.god_work"></a>
<strong>instantiatable_class.god_work</strong>
</dt>
<dd>
Instantiatable_class
<h3>Fields:</h3>
<ul>
<li><span class="parameter">instance</span>
defines wether the object is an instance
</li>
<li><span class="parameter">base_class</span>
only present for instances: the class from which this instance originates
</li>
<li><span class="parameter">parent_class</span>
the class from which this class was inherited from
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Methods"></a>Methods</h2>
<dl class="function">
<dt>
<a name = "instantiatable_class:inherit"></a>
<strong>instantiatable_class:inherit (def)</strong>
</dt>
<dd>
creates a new base class. Calls all constructors in the chain with def.instance=true
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">def</span>
the table containing a new definition (where the class calling the method is the parent). The content of the definition will override the fields for it's children.
</li>
</ul>
<h3>Returns:</h3>
<ol>
def a new base class
</ol>
</dd>
<dt>
<a name = "instantiatable_class:construct"></a>
<strong>instantiatable_class:construct ()</strong>
</dt>
<dd>
construct
every parent constructor is called in order of inheritance, this is used to make changes to the child table. In self you will find base_class defining what class it is from, and the bool instance indicating (shocking) wether it is an instance.
</dd>
<dt>
<a name = "instantiatable_class:new"></a>
<strong>instantiatable_class:new ()</strong>
</dt>
<dd>
creates an instance of the base class. Calls all constructors in the chain with def.instance=true
<h3>Returns:</h3>
<ol>
def a new instance of the class.
</ol>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-06-18 17:20:58 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,116 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>4dguns</h1>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="modules/classes.player_model_handler.html">classes.player_model_handler</a></li>
<li><a href="modules/default_controls.html">default_controls</a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="scripts/item_entities.lua.html">item_entities.lua</a></li>
<li><a href="scripts/misc_helpers.html">misc_helpers</a></li>
<li><a href="scripts/play_sound.html">play_sound</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
<li><a href="classes/Gun.html">Gun</a></li>
<li><a href="classes/Instantiatable_class.html">Instantiatable_class</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h2>THEE ultimate 3d gun library.</h2>
<h2>Modules</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="modules/classes.player_model_handler.html">classes.player_model_handler</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/default_controls.html">default_controls</a></td>
<td class="summary">a default control system for aiming, reloading, firing, reloading, and more.</td>
</tr>
</table>
<h2>Scripts</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="scripts/item_entities.lua.html">item_entities.lua</a></td>
<td class="summary">adds 3d items for guns and magazines</td>
</tr>
<tr>
<td class="name" nowrap><a href="scripts/misc_helpers.html">misc_helpers</a></td>
<td class="summary">misc.</td>
</tr>
<tr>
<td class="name" nowrap><a href="scripts/play_sound.html">play_sound</a></td>
<td class="summary">implements tools for quickly playing audio.</td>
</tr>
</table>
<h2>Classes</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="classes/Gun.html">Gun</a></td>
<td class="summary">Gun class</td>
</tr>
<tr>
<td class="name" nowrap><a href="classes/Instantiatable_class.html">Instantiatable_class</a></td>
<td class="summary">Instantiatable_class.</td>
</tr>
</table>
<h2>Topics</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="topics/readme.md.html">readme.md</a></td>
<td class="summary"></td>
</tr>
</table>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-06-18 17:20:58 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,290 +0,0 @@
body {
color: #47555c;
font-size: 16px;
font-family: "Open Sans", sans-serif;
margin: 0;
background: #eff4ff;
}
a:link { color: #008fee; }
a:visited { color: #008fee; }
a:hover { color: #22a7ff; }
h1 { font-size:26px; font-weight: normal; }
h2 { font-size:22px; font-weight: normal; }
h3 { font-size:18px; font-weight: normal; }
h4 { font-size:16px; font-weight: bold; }
hr {
height: 1px;
background: #c1cce4;
border: 0px;
margin: 15px 0;
}
code, tt {
font-family: monospace;
}
span.parameter {
font-family: monospace;
font-weight: bold;
color: rgb(99, 115, 131);
}
span.parameter:after {
content:":";
}
span.types:before {
content:"(";
}
span.types:after {
content:")";
}
.type {
font-weight: bold; font-style:italic
}
p.name {
font-family: "Andale Mono", monospace;
}
#navigation {
float: left;
background-color: white;
border-right: 1px solid #d3dbec;
border-bottom: 1px solid #d3dbec;
width: 14em;
vertical-align: top;
overflow: visible;
}
#navigation br {
display: none;
}
#navigation h1 {
background-color: white;
border-bottom: 1px solid #d3dbec;
padding: 15px;
margin-top: 0px;
margin-bottom: 0px;
}
#navigation h2 {
font-size: 18px;
background-color: white;
border-bottom: 1px solid #d3dbec;
padding-left: 15px;
padding-right: 15px;
padding-top: 10px;
padding-bottom: 10px;
margin-top: 30px;
margin-bottom: 0px;
}
#content h1 {
background-color: #2c3e67;
color: white;
padding: 15px;
margin: 0px;
}
#content h2 {
background-color: #6c7ea7;
color: white;
padding: 15px;
padding-top: 15px;
padding-bottom: 15px;
margin-top: 0px;
}
#content h2 a {
background-color: #6c7ea7;
color: white;
text-decoration: none;
}
#content h2 a:hover {
text-decoration: underline;
}
#content h3 {
font-style: italic;
padding-top: 15px;
padding-bottom: 4px;
margin-right: 15px;
margin-left: 15px;
margin-bottom: 5px;
border-bottom: solid 1px #bcd;
}
#content h4 {
margin-right: 15px;
margin-left: 15px;
border-bottom: solid 1px #bcd;
}
#content pre {
margin: 15px;
}
pre {
background-color: rgb(50, 55, 68);
color: white;
border-radius: 3px;
/* border: 1px solid #C0C0C0; /* silver */
padding: 15px;
overflow: auto;
font-family: "Andale Mono", monospace;
}
#content ul pre.example {
margin-left: 0px;
}
table.index {
/* border: 1px #00007f; */
}
table.index td { text-align: left; vertical-align: top; }
#navigation ul
{
font-size:1em;
list-style-type: none;
margin: 1px 1px 10px 1px;
}
#navigation li {
text-indent: -1em;
display: block;
margin: 3px 0px 0px 22px;
}
#navigation li li a {
margin: 0px 3px 0px -1em;
}
#content {
margin-left: 14em;
}
#content p {
padding-left: 15px;
padding-right: 15px;
}
#content table {
padding-left: 15px;
padding-right: 15px;
background-color: white;
}
#content p, #content table, #content ol, #content ul, #content dl {
max-width: 900px;
}
#about {
padding: 15px;
padding-left: 16em;
background-color: white;
border-top: 1px solid #d3dbec;
border-bottom: 1px solid #d3dbec;
}
table.module_list, table.function_list {
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
margin: 15px;
}
table.module_list td, table.function_list td {
border-width: 1px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
border: solid 1px rgb(193, 204, 228);
}
table.module_list td.name, table.function_list td.name {
background-color: white; min-width: 200px; border-right-width: 0px;
}
table.module_list td.summary, table.function_list td.summary {
background-color: white; width: 100%; border-left-width: 0px;
}
dl.function {
margin-right: 15px;
margin-left: 15px;
border-bottom: solid 1px rgb(193, 204, 228);
border-left: solid 1px rgb(193, 204, 228);
border-right: solid 1px rgb(193, 204, 228);
background-color: white;
}
dl.function dt {
color: rgb(99, 123, 188);
font-family: monospace;
border-top: solid 1px rgb(193, 204, 228);
padding: 15px;
}
dl.function dd {
margin-left: 15px;
margin-right: 15px;
margin-top: 5px;
margin-bottom: 15px;
}
#content dl.function dd h3 {
margin-top: 0px;
margin-left: 0px;
padding-left: 0px;
font-size: 16px;
color: rgb(128, 128, 128);
border-bottom: solid 1px #def;
}
#content dl.function dd ul, #content dl.function dd ol {
padding: 0px;
padding-left: 15px;
list-style-type: none;
}
ul.nowrap {
overflow:auto;
white-space:nowrap;
}
.section-description {
padding-left: 15px;
padding-right: 15px;
}
/* stop sublists from having initial vertical space */
ul ul { margin-top: 0px; }
ol ul { margin-top: 0px; }
ol ol { margin-top: 0px; }
ul ol { margin-top: 0px; }
/* make the target distinct; helps when we're navigating to a function */
a:target + * {
background-color: #FF9;
}
/* styles for prettification of source */
pre .comment { color: #bbccaa; }
pre .constant { color: #a8660d; }
pre .escape { color: #844631; }
pre .keyword { color: #ffc090; font-weight: bold; }
pre .library { color: #0e7c6b; }
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
pre .string { color: #8080ff; }
pre .number { color: #f8660d; }
pre .operator { color: #2239a8; font-weight: bold; }
pre .preprocessor, pre .prepro { color: #a33243; }
pre .global { color: #c040c0; }
pre .user-keyword { color: #800080; }
pre .prompt { color: #558817; }
pre .url { color: #272fc2; text-decoration: underline; }

View File

@ -1,85 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>4dguns</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><strong>classes.player_model_handler</strong></li>
<li><a href="../modules/default_controls.html">default_controls</a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="../scripts/item_entities.lua.html">item_entities.lua</a></li>
<li><a href="../scripts/misc_helpers.html">misc_helpers</a></li>
<li><a href="../scripts/play_sound.html">play_sound</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
<li><a href="../classes/Gun.html">Gun</a></li>
<li><a href="../classes/Instantiatable_class.html">Instantiatable_class</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>classes.player_model_handler</code></h1>
<p>
</p>
<p>
</p>
<br/>
<br/>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-06-18 17:20:58 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,83 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>4dguns</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/classes.player_model_handler.html">classes.player_model_handler</a></li>
<li><strong>default_controls</strong></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="../scripts/item_entities.lua.html">item_entities.lua</a></li>
<li><a href="../scripts/misc_helpers.html">misc_helpers</a></li>
<li><a href="../scripts/play_sound.html">play_sound</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
<li><a href="../classes/Gun.html">Gun</a></li>
<li><a href="../classes/Instantiatable_class.html">Instantiatable_class</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>default_controls</code></h1>
<p>a default control system for aiming, reloading, firing, reloading, and more.</p>
<p>
</p>
<br/>
<br/>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-06-18 17:20:58 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,173 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>4dguns</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><strong>item_entities.lua</strong></li>
<li><a href="../scripts/misc_helpers.html">misc_helpers</a></li>
<li><a href="../scripts/play_sound.html">play_sound</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/classes.player_model_handler.html">classes.player_model_handler</a></li>
<li><a href="../modules/default_controls.html">default_controls</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
<li><a href="../classes/Gun.html">Gun</a></li>
<li><a href="../classes/Instantiatable_class.html">Instantiatable_class</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Script <code>item_entities.lua</code></h1>
<p>adds 3d items for guns and magazines</p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Guns4d.register_item">Guns4d.register_item (itemstring, def)</a></td>
<td class="summary">replaces the item entity of the provided item with a 3d entity based on the definition</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#guns4d_itemdef">guns4d_itemdef</a></td>
<td class="summary">table defining the new 3d entity for a dropped item</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "Guns4d.register_item"></a>
<strong>Guns4d.register_item (itemstring, def)</strong>
</dt>
<dd>
replaces the item entity of the provided item with a 3d entity based on the definition
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">itemstring</span>
</li>
<li><span class="parameter">def</span>
, a <a href="../scripts/item_entities.lua.html#guns4d_itemdef">guns4d_itemdef</a>
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "guns4d_itemdef"></a>
<strong>guns4d_itemdef</strong>
</dt>
<dd>
table defining the new 3d entity for a dropped item
<h3>Fields:</h3>
<ul>
<li><span class="parameter">light_source</span>
int, equivelant to minetest itemdef version
</li>
<li><span class="parameter">size</span>
int, the size of the collision box
</li>
<li><span class="parameter">mesh</span>
string, the mesh to use for the item
</li>
<li><span class="parameter">textures</span>
table, a list of textures (see minetest entity documentation)
</li>
<li><span class="parameter">collisionbox_size</span>
, the size of collisionbox in tenths of meters.
</li>
<li><span class="parameter">selectionbox</span>
vector, xyz scale of the selectionbox
</li>
<li><span class="parameter">offset</span>
vector, xyz offset of the visual object from the collision and selectionbox. (so that magazines's origin can match their bone.)
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-06-18 17:20:58 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,126 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>4dguns</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#math_helpers">math helpers </a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="../scripts/item_entities.lua.html">item_entities.lua</a></li>
<li><strong>misc_helpers</strong></li>
<li><a href="../scripts/play_sound.html">play_sound</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/classes.player_model_handler.html">classes.player_model_handler</a></li>
<li><a href="../modules/default_controls.html">default_controls</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
<li><a href="../classes/Gun.html">Gun</a></li>
<li><a href="../classes/Instantiatable_class.html">Instantiatable_class</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Script <code>misc_helpers</code></h1>
<p>misc.</p>
<p> common tools for 4dguns</p>
<h2><a href="#math_helpers">math helpers </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#weighted_randoms">weighted_randoms (tbl)</a></td>
<td class="summary">picks a random index, with odds based on it's value.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header has-description"><a name="math_helpers"></a>math helpers </h2>
<div class="section-description">
in guns4d.math
</div>
<dl class="function">
<dt>
<a name = "weighted_randoms"></a>
<strong>weighted_randoms (tbl)</strong>
</dt>
<dd>
picks a random index, with odds based on it's value. Returns the index of the selected.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">tbl</span>
<p> a table containing weights, example</p>
<pre><code> {
["sound"] = 999, --999 in 1000 chance this is chosen
["rare_sound"] = 1 --1 in 1000 chance this is chosen
}
</code></pre>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-06-18 17:20:58 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,212 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>4dguns</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="../scripts/item_entities.lua.html">item_entities.lua</a></li>
<li><a href="../scripts/misc_helpers.html">misc_helpers</a></li>
<li><strong>play_sound</strong></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/classes.player_model_handler.html">classes.player_model_handler</a></li>
<li><a href="../modules/default_controls.html">default_controls</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
<li><a href="../classes/Gun.html">Gun</a></li>
<li><a href="../classes/Instantiatable_class.html">Instantiatable_class</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/readme.md.html">readme</a></li>
</ul>
</div>
<div id="content">
<h1>Script <code>play_sound</code></h1>
<p>implements tools for quickly playing audio.</p>
<p>
</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Guns4d.play_sounds">Guns4d.play_sounds (sound_specs)</a></td>
<td class="summary">allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Guns4d.stop_sounds">Guns4d.stop_sounds (handle_list)</a></td>
<td class="summary">stops a list of sounds</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#guns4d_soundspec">guns4d_soundspec</a></td>
<td class="summary">defines a sound.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "Guns4d.play_sounds"></a>
<strong>Guns4d.play_sounds (sound_specs)</strong>
</dt>
<dd>
allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions.
WARNING: this function modifies the tables passed to it, use <code>Guns4d.table.shallow_copy()</code> for guns4d_soundspecs
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">sound_specs</span>
<p> a <a href="../scripts/play_sound.html#guns4d_soundspec">guns4d_soundspec</a> or a list of <a href="../scripts/play_sound.html#guns4d_soundspec">guns4d_soundspec</a>s indexed my number. Also allows for shared fields. Example:</p>
<pre><code> {
to_player = "singeplayer",
min_distance = 100, --soundspec_to_play1 &amp; soundspec_to_play2 share this parameter (as well as the to_player)
soundspec_to_play1,
soundspec_to_play2
}
</code></pre>
</li>
</ul>
<h3>Returns:</h3>
<ol>
out a Guns4d sound handle (an integer)
</ol>
</dd>
<dt>
<a name = "Guns4d.stop_sounds"></a>
<strong>Guns4d.stop_sounds (handle_list)</strong>
</dt>
<dd>
stops a list of sounds
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">handle_list</span>
a list of minetest sound handles to stop, this is the returned output of @{guns4d.play_sounds
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "guns4d_soundspec"></a>
<strong>guns4d_soundspec</strong>
</dt>
<dd>
defines a sound.
This is passed to <code>minetest.sound_play</code> as a <a href="https://github.com/minetest/minetest/blob/master/doc/lua_api.md#sound-parameter-table"> sound parameter table</a>
however has the following changed or guns4d specific parameters.
<h3>Fields:</h3>
<ul>
<li><span class="parameter">min_hear_distance</span>
this is useful if you wish to play a sound which has a "far" sound, such as distant gunshots. incompatible <code>with to_player</code>
</li>
<li><span class="parameter">sounds</span>
a <a href="../scripts/misc_helpers.html#weighted_randoms"> weighted_randoms table</a> for randomly selecting sounds. The output will overwrite the <code>sound</code> field.
</li>
<li><span class="parameter">to_player</span>
4dguns changes <code>to_player</code> so it only plays positionless audio (as it is only intended for first person audio). If set to string "from_player" and player present
</li>
<li><span class="parameter">player</span>
this is so to<em>player being set to "from</em>player". It's to be set to the player which fired the weapon.
</li>
<li><span class="parameter">delay</span>
delay the playing of the sound
</li>
<li><span class="parameter">attenuation_rate</span>
float the rate of dropoff for a sound. I figure this is a bit more intuitive then jacking the gain up super high for every sound... Set the default in config.
</li>
<li><span class="parameter">split_audio_by_perspective</span>
true [GUN CLASS SPECIFIC] tells the gun wether to split into third and first person (positionless) audio and adjust gain.
</li>
<li><span class="parameter">third_person_gain_multiplier</span>
float [GUN CLASS SPECIFIC] replaces the constant/config value "third<em>person</em>gain<em>multiplier/THIRD</em>PERSON<em>GAIN</em>MULTIPLIER".
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-06-18 17:20:58 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,74 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>4dguns documentation</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>4dguns</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><strong>readme</strong></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/classes.player_model_handler.html">classes.player_model_handler</a></li>
<li><a href="../modules/default_controls.html">default_controls</a></li>
</ul>
<h2>Scripts</h2>
<ul class="nowrap">
<li><a href="../scripts/item_entities.lua.html">item_entities.lua</a></li>
<li><a href="../scripts/misc_helpers.html">misc_helpers</a></li>
<li><a href="../scripts/play_sound.html">play_sound</a></li>
</ul>
<h2>Classes</h2>
<ul class="nowrap">
<li><a href="../classes/Gun.html">Gun</a></li>
<li><a href="../classes/Instantiatable_class.html">Instantiatable_class</a></li>
</ul>
</div>
<div id="content">
<h1>4dguns</h1>
<p>3dguns remastered. Currently a work in progress that is updating steadily (kind of).</p>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/lunarmodules/ldoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2024-06-18 17:20:58 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -1,3 +0,0 @@
# literally just so I dont have to open powershell every time.
@echo off
ldoc ./

View File

@ -1,5 +1,3 @@
--- adds 3d items for guns and magazines
-- @script item_entities.lua
Guns4d.registered_items = {}
local old_spawn_item = core.spawn_item --didnt know if I had to use core instead of minetest or if they are the same reference, not chancing it though.
@ -19,19 +17,8 @@ core.spawn_item = function(pos, item, ...)
return old_spawn_item(pos, item, ...)
end
--- table defining the new 3d entity for a dropped item
-- @field light_source int, equivelant to minetest itemdef version
-- @field size int, the size of the collision box
-- @field mesh string, the mesh to use for the item
-- @field textures table, a list of textures (see minetest entity documentation)
-- @field collisionbox_size, the size of collisionbox in tenths of meters.
-- @field selectionbox vector, xyz scale of the selectionbox
-- @field offset vector, xyz offset of the visual object from the collision and selectionbox. (so that magazines's origin can match their bone.)
-- @table guns4d_itemdef
local defaults = {
--light_source = 0,
collisionbox_size = 2,
visual_size = 1,
realistic = Guns4d.config.realistic_items,
backface_culling = false,
@ -39,10 +26,7 @@ local defaults = {
selectionbox = {-.2,-.2,-.2, .2,.2,.2},
collisionbox = (Guns4d.config.realistic_items and {-.2,-.05,-.2, .2,.15,.2}) or {-.2,-.2,-.2, .2,.2,.2}
}
--- replaces the item entity of the provided item with a 3d entity based on the definition
-- @param itemstring
-- @param def, a @{guns4d_itemdef}
-- @function Guns4d.register_item()
function Guns4d.register_item(itemstring, def)
assert(minetest.registered_items[itemstring], "item: `"..tostring(itemstring).."` not registered by minetest")
assert(type(def)=="table", "definition is not a table")

View File

@ -1,59 +1,46 @@
--- implements tools for quickly playing audio.
-- @script play_sound
-- @module play_sound
local sqrt = math.sqrt
--simple specification for playing a sound in relation to an action, acts as a layer of minetest.play_sound
--"gsp" guns4d-sound-spec
--first person for the gun holder, third person for everyone else. If first not present, third will be used.
--passes table directly to minetest.play_sound and adds a few additional parameters
--example:
--[[
additional properties
sounds = { --weighted randoms:
fire_fp = .5.
fire_fp_2 = .2.
fire_fp_3 = .3
},
pitch = {
min = .6,
max = 1
},
gain = 1, --format for pitch and gain is interchangable.
min_hear_distance = 20, --this is for distant gunshots, for example. Entirely optional. Cannot be used with to_player
exclude_player
to_player
--when present it automatically plays positionless audio, as this is for first person effects.
]]
--- defines a sound.
-- This is passed to `minetest.sound_play` as a [ sound parameter table](https://github.com/minetest/minetest/blob/master/doc/lua_api.md#sound-parameter-table)
-- however has the following changed or guns4d specific parameters.
-- @field min_hear_distance this is useful if you wish to play a sound which has a "far" sound, such as distant gunshots. incompatible `with to_player`
-- @field sounds a @{misc_helpers.weighted_randoms| weighted_randoms table} for randomly selecting sounds. The output will overwrite the `sound` field.
-- @field to_player 4dguns changes `to_player` so it only plays positionless audio (as it is only intended for first person audio). If set to string "from_player" and player present
-- @field player this is so to_player being set to "from_player". It's to be set to the player which fired the weapon.
-- @field delay delay the playing of the sound
-- @field attenuation_rate float the rate of dropoff for a sound. I figure this is a bit more intuitive then jacking the gain up super high for every sound... Set the default in config.
-- @field split_audio_by_perspective true [GUN CLASS SPECIFIC] tells the gun wether to split into third and first person (positionless) audio and adjust gain.
-- @field third_person_gain_multiplier float [GUN CLASS SPECIFIC] replaces the constant/config value "third_person_gain_multiplier/THIRD_PERSON_GAIN_MULTIPLIER".
--- Guns4d soundspec
--
-- simple specification for playing a sound in relation to an action, acts as a layer of minetest.play_sound.
-- ATTENTION: read lua_api.md for more parameters! all parameters from there are valid unless otherwise stated here, these are auxillary.
-- @table guns4d_soundspec
-- @compact
-- @field min_hear_distance `float` this is useful if you wish to play a sound which has a "far" sound, such as distant gunshots. incompatible `with to_player`
-- @field sounds `table` a @{misc_helpers.weighted_randoms| weighted_randoms table} for randomly selecting sounds. The output will overwrite the `sound` field.
-- @field to_player `objRef` 4dguns changes `to_player` so it only plays positionless audio (as it is only intended for first person audio). If set to string "from_player" and player present
-- @field player `objRef` this is so to_player being set to "from_player". It's to be set to the player which fired the weapon.
-- @field delay `float` delays the playing of the sound
-- @field attenuation_rate `float` the rate of dropoff for a sound. I figure this is a bit more intuitive then jacking the gain up super high for every sound... Set the default in config.
-- @field split_audio_by_perspective `bool` [GUN CLASS SPECIFIC] tells the gun wether to split into third and first person (positionless) audio and adjust gain.
-- @field third_person_gain_multiplier `float` [GUN CLASS SPECIFIC] replaces the constant/config value "third_person_gain_multiplier/THIRD_PERSON_GAIN_MULTIPLIER".
-- @example
-- soundspec = {
-- sounds = { --weighted randoms
-- fire_fp = .5.
-- fire_fp_2 = .2.
-- fire_fp_3 = .3
-- },
-- pitch = {
-- min = .6,
-- max = 1
-- },
-- gain = 1, --format for pitch and gain is interchangable.
-- min_hear_distance = 20, --this is for distant gunshots, for example. Entirely optional. Cannot be used with to_player
-- exclude_player
-- to_player
-- --when present it automatically plays positionless audio, as this is for first person effects.
-- }
--
local function handle_min_max(tbl)
return tbl.min+(math.random()*(tbl.max-tbl.min))
end
--- allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions.
-- WARNING: this function modifies the tables passed to it, use `Guns4d.table.shallow_copy()` for guns4d_soundspecs
-- @param sound_specs a @{guns4d_soundspec} or a list of @{guns4d_soundspec}s indexed my number. Also allows for shared fields. Example:
-- {
-- to_player = "singeplayer",
-- min_distance = 100, --soundspec_to_play1 & soundspec_to_play2 share this parameter (as well as the to_player)
-- soundspec_to_play1,
-- soundspec_to_play2
-- }
-- @return out a Guns4d sound handle (an integer)
-- @function Guns4d.play_sounds
local sound_handles = {}
local function play_sound(sound, soundspec, handle, i)
if soundspec.delay then
@ -66,6 +53,19 @@ local function play_sound(sound, soundspec, handle, i)
sound_handles[handle][i] = minetest.sound_play(sound, soundspec)
end
end
--- allows you to play one or more sounds with more complex features, so sounds can be easily coded for guns without the need for functions.
--
-- WARNING: this function modifies the tables passed to it, use `Guns4d.table.shallow_copy()` or `table.copy` for inputted soundspecs
-- @example
-- {
-- to_player = "singeplayer",
-- min_distance = 100, --soundspec_to_play1 & soundspec_to_play2 will share this field as it is in the higher level table (as well as the above field)
-- soundspec_to_play1, --a sound parameter table
-- soundspec_to_play2
-- }
-- @tparam table soundspecs_list a list a list of soundspecs optionally accompanied with fields to be used in all of them.
-- @treturn integer guns4d sound handle, used by stop_sounds & get_sounds
function Guns4d.play_sounds(soundspecs_list)
--print(dump(soundspecs_list))
--support a list of sounds to play
@ -133,18 +133,22 @@ function Guns4d.play_sounds(soundspecs_list)
end
return handle
end
-- @param handle a Guns4d sound handle
-- @function Guns4d.get_sounds gets a list of currently playing Minetest sound handles from the Guns4d sound handle. Modification not reccomended.
--- gets a list of currently playing Minetest sound handles from the Guns4d sound handle. Modification of table highly discouraged.
-- @tparam integer handle a sound handle as returned by play_sounds
-- @treturn table a list of sound handles as returned by minetest.sound_play()
function Guns4d.get_sounds(handle)
return sound_handles[handle]
end
--- stops a list of sounds
-- @param handle_list a list of minetest sound handles to stop, this is the returned output of @{guns4d.play_sounds
-- @function Guns4d.stop_sounds
-- @tparam integer|table handle a guns4d sound handle OR list of minetest sound handles to stop
-- @treturn bool returns true if successful.
function Guns4d.stop_sounds(handle)
local handle_list = (type(handle) == "table" and handle) or sound_handles[handle]
if not handle_list then return false end
sound_handles[handle] = false --indicate to not play any delayed noises.
if type(handle) == "number" then
sound_handles[handle] = false --indicate to not play any delayed noises.
end
for i, v in pairs(handle_list) do
minetest.sound_stop(v)
end