updated documentation, layed out foundation for attachments

This commit is contained in:
FatalErr42O 2024-08-02 22:10:30 -07:00
parent 5e29bc07e1
commit b3ad0ba074
19 changed files with 206 additions and 145 deletions

View File

@ -347,11 +347,15 @@ local gun_default = {
}, },
--- offsets --- 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. -- a list of tables each containing offset vectors These are required for automatic initialization of offsets.
-- @example -- @example
-- recoil = { -- recoil = {
-- gun_axial = {x=0, y=0} -- gun_axial = {x=0, y=0}, --rotation of the gun around it's origin
-- player_axial = {x=0, y=0} -- player_axial = {x=0, y=0}, --rotation of the gun around the bone it's attached to
-- --translations of gun
-- player_trans = {x=0, y=0, z=0}, --translation of the bone the gun is attached to
-- eye_trans = {x=0, y=0, z=0}, --trnaslation of the player's look
-- gun_tran = {x=0, y=0, z=0}s --translation of the gun relative to the bone it's attachted to.
-- } -- }
-- @table lvl1_fields.offsets -- @table lvl1_fields.offsets
-- @compact -- @compact
@ -518,7 +522,7 @@ function gun_default:update(dt)
--translations --translations
total_offset.player_trans.x = 0; total_offset.player_trans.y = 0; total_offset.player_trans.z = 0 total_offset.player_trans.x = 0; total_offset.player_trans.y = 0; total_offset.player_trans.z = 0
total_offset.gun_trans.x = 0; total_offset.gun_trans.y = 0; total_offset.gun_trans.z = 0 total_offset.gun_trans.x = 0; total_offset.gun_trans.y = 0; total_offset.gun_trans.z = 0
total_offset.look_trans.x = 0; total_offset.look_trans.y = 0; total_offset.gun_trans.z = 0 total_offset.look_trans.x = 0; total_offset.look_trans.y = 0; total_offset.look_trans.z = 0
--this doesnt work. --this doesnt work.
for type, _ in pairs(total_offset) do for type, _ in pairs(total_offset) do
for i, offset in pairs(self.offsets) do for i, offset in pairs(self.offsets) do
@ -540,7 +544,13 @@ function gun_default:update_burstfire()
end end
end end
function gun_default:cycle_firemodes() function gun_default:cycle_firemodes()
self.current_firemode = ((self.current_firemode)%(#self.properties.firemodes))+1 --cannot get length using length operator because it's a proxy table
local length = 0
for i, v in ipairs(self.properties.firemodes) do
length = length+1
end
self.current_firemode = ((self.current_firemode)%(length))+1
self.meta:set_int("guns4d_firemode", self.current_firemode) self.meta:set_int("guns4d_firemode", self.current_firemode)
self:update_image_and_text_meta() self:update_image_and_text_meta()
self.player:set_wielded_item(self.itemstack) self.player:set_wielded_item(self.itemstack)
@ -569,7 +579,11 @@ function gun_default:update_image_and_text_meta(meta)
image = self.properties.inventory_image_empty image = self.properties.inventory_image_empty
end end
--add the firemode overlay to the image --add the firemode overlay to the image
if #self.properties.firemodes > 1 and self.properties.firemode_inventory_overlays[self.properties.firemodes[self.current_firemode]] then local firemodes = 0
for i, v in pairs(self.properties.firemodes) do
firemodes = firemodes+1
end
if firemodes > 1 and self.properties.firemode_inventory_overlays[self.properties.firemodes[self.current_firemode]] then
image = image.."^"..self.properties.firemode_inventory_overlays[self.properties.firemodes[self.current_firemode]] image = image.."^"..self.properties.firemode_inventory_overlays[self.properties.firemodes[self.current_firemode]]
end end
if self.handler.infinite_ammo then if self.handler.infinite_ammo then
@ -675,15 +689,19 @@ function gun_default:update_look_offsets(dt)
gun_axial.x = Guns4d.math.clamp(offset, 0, 15*(offset/math.abs(offset))) gun_axial.x = Guns4d.math.clamp(offset, 0, 15*(offset/math.abs(offset)))
gun_axial.x = gun_axial.x+(pitch*(1-hip.axis_rotation_ratio)) gun_axial.x = gun_axial.x+(pitch*(1-hip.axis_rotation_ratio))
self.offsets.look.player_axial.x = -pitch*(1-hip.axis_rotation_ratio) self.offsets.look.player_axial.x = -pitch*(1-hip.axis_rotation_ratio)
self.offsets.look.look_trans.x = 0 self.offsets.look.look_trans.x = 0
else else
self.offsets.look.gun_axial.x = 0 self.offsets.look.gun_axial.x = 0
--aiming look translations self.offsets.look.player_axial.x = 0
end end
local location = Guns4d.math.clamp(Guns4d.math.smooth_ratio(self.control_handler.ads_location)*2, 0, 1) local location = Guns4d.math.clamp(Guns4d.math.smooth_ratio(self.control_handler.ads_location)*2, 0, 1)
self.offsets.look.look_trans.x = ads.horizontal_offset*location self.offsets.look.look_trans.x = ads.horizontal_offset*location
local fwd_offset = 0
if look_rotation.x < 0 then --minetest's pitch is inverted, checking here if it's above horizon.
fwd_offset = math.abs(math.sin(look_rotation.x*math.pi/180))*props.ads.offset.z*location
end
self.offsets.look.player_trans.z = fwd_offset
self.offsets.look.look_trans.z = fwd_offset
end end
--============================================== positional info ===================================== --============================================== positional info =====================================
--all of this dir shit needs to be optimized HARD --all of this dir shit needs to be optimized HARD
@ -763,7 +781,6 @@ function gun_default:get_pos(offset_pos, relative, ads, ignore_translations)
pos = Vec.rotate(bone_location, {x=0, y=-handler.look_rotation.y*math.pi/180, z=0}) pos = Vec.rotate(bone_location, {x=0, y=-handler.look_rotation.y*math.pi/180, z=0})
pos = pos+Vec.rotate(gun_translation, Vec.dir_to_rotation(self.paxial_dir)) pos = pos+Vec.rotate(gun_translation, Vec.dir_to_rotation(self.paxial_dir))
else else
print(dump(bone_location))
pos = Vec.rotate(gun_translation, Vec.dir_to_rotation(self.local_paxial_dir)+{x=self.player_rotation.x*math.pi/180,y=0,z=0})+bone_location pos = Vec.rotate(gun_translation, Vec.dir_to_rotation(self.local_paxial_dir)+{x=self.player_rotation.x*math.pi/180,y=0,z=0})+bone_location
end end
--[[local hud_pos --[[local hud_pos
@ -815,7 +832,7 @@ function gun_default:update_entity()
visibility = false visibility = false
end end
--Irrlicht uses counterclockwise but we use clockwise. --Irrlicht uses counterclockwise but we use clockwise.
local pos = {} local pos = self.gun_translation
local ads = props.ads.offset local ads = props.ads.offset
local hip = props.hip.offset local hip = props.hip.offset
local offset = self.total_offsets.gun_trans local offset = self.total_offsets.gun_trans

View File

@ -65,7 +65,7 @@ Guns4d.player_model_handler = {
local player_model = Guns4d.player_model_handler local player_model = Guns4d.player_model_handler
function player_model.set_default_handler(class_or_name) function player_model.set_default_handler(class_or_name)
assert(class_or_name, "class or mesh name (string) needed. Example: 'character.b3d' sets the default handler to whatever handler is used for character.b3d.") assert(class_or_name, "class or mesh name (string) needed. Example: 'character.b3d' sets the default handler to whatever handler is used for character.b3d.")
local handler = assert(((type(class_or_name) == "table") and class_or_name) or player_model.get_handler(class_or_name), "no handler by the name '"..tostring(class_or_name).."' found.") local handler = assert(((type(class_or_name) == "class") and class_or_name) or player_model.get_handler(class_or_name), "no handler by the name '"..tostring(class_or_name).."' found.")
assert(not handler.instance, "cannot set instance of a handler as the default player_model_handler") assert(not handler.instance, "cannot set instance of a handler as the default player_model_handler")
player_model.default_handler = handler player_model.default_handler = handler
end end
@ -184,7 +184,7 @@ function player_model:update_aiming(dt)
pos.x = (pos.x/10)*vs.x pos.x = (pos.x/10)*vs.x
pos.y = (pos.y/10)*vs.y pos.y = (pos.y/10)*vs.y
pos.z = (pos.z/10)*vs.z pos.z = (pos.z/10)*vs.z
minetest.chat_send_all(dump(pos)) -- minetest.chat_send_all(dump(pos))
end end
function player_model:update_arm_bones(dt) function player_model:update_arm_bones(dt)

View File

@ -1,60 +0,0 @@
--
Proxy_table = {
registered_proxies = {},
proxy_children = {}
}
--this creates proxy tables in a structure of tables
--this is great if you want to prevent the change of a table
--but still want it to be viewable, such as with constants
function Proxy_table:new(og_table, parent)
local new = {}
self.registered_proxies[og_table] = new
if parent then
self.proxy_children[parent][og_table] = true
else
self.proxy_children[og_table] = {}
parent = og_table
end
--set the proxy's metatable
setmetatable(new, {
__index = function(t, key)
if type(og_table[key]) == "table" then
return Proxy_table:get_or_create(og_table[key], parent)
else
return og_table[key]
end
end,
__newindex = function(table, key)
assert(false, "attempt to edit immutable table, cannot edit a proxy")
end,
})
--[[overwrite og_table meta to destroy the proxy aswell (but I realized it wont be GCed unless it's removed altogether, so this is pointless)
local mtable = getmetatable(og_table)
local old_gc = mtable.__gc
mtable.__gc = function(t)
self.registered_proxies[t] = nil
self.proxy_children[t] = nil
old_gc(t)
end
setmetatable(og_table, mtable)]]
--premake proxy tables
for i, v in pairs(og_table) do
if type(v) == "table" then
Proxy_table:get_or_create(v, parent)
end
end
return new
end
function Proxy_table:get_or_create(og_table, parent)
return self.registered_proxies[og_table] or Proxy_table:new(og_table, parent)
end
function Proxy_table:destroy_proxy(parent)
self.registered_proxies[parent] = nil
if self.proxy_children[parent] then
for i, v in pairs(self.proxy_children[parent]) do
Proxy_table:destroy_proxy(i)
end
end
self.proxy_children[parent] = nil
end

View File

@ -110,6 +110,7 @@ function gun_default:construct_instance()
}) })
end end
if self.custom_construct then self:custom_construct() end if self.custom_construct then self:custom_construct() end
self.properties = mtul.class.proxy_table:new(self.properties)
end end
--[[ --[[

View File

@ -6,7 +6,7 @@
<title>Gun - Guns4d</title> <title>Gun - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" /> <link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css"> <link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head> </head>
<body class="class-gun"> <body class="class-gun">
<div class="topbar"> <div class="topbar">
@ -16,7 +16,7 @@
<div class="group two"> <div class="group two">
</div> </div>
<div class="group three"> <div class="group three">
<div class="button iconright"><a href="../class/mtul.class.new_class.html" title="mtul.class.new_class"><span>Next</span><img src="../img/i-right.svg?7653a2d" alt=""/></a></div> <div class="button iconright"><a href="../class/player_model_handler.html" title="player_model_handler"><span>Next</span><img src="../img/i-right.svg?7653a2d" alt=""/></a></div>
</div> </div>
</div> </div>
<div class="sidebar"> <div class="sidebar">
@ -61,7 +61,7 @@
<div class="heading">Classes</div> <div class="heading">Classes</div>
<ul> <ul>
<li class="selected"><a href="../class/Gun.html">Gun.Gun</a></li> <li class="selected"><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/mtul.class.new_class.html">mtul.class.new_class.mtul.class.new_class</a></li> <li><a href="../class/player_model_handler.html">Player_model_handler.player_model_handler</a></li>
</ul> </ul>
</div> </div>
<div class="modules"> <div class="modules">
@ -71,7 +71,6 @@
<li><a href="../module/play_sound.html">play_sound</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/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="../module/Control_handler.html">Control_handler</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> </ul>
</div> </div>
</div> </div>
@ -88,7 +87,7 @@
<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, <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, 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> 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, <p>Guns4d uses a class system for most moving parts- including the gun. New guns therefore are created with the :inherit(def) method,
where def is the definition of your new gun- or rather the changed parts of it. So to make a new gun you can run Guns4d.gun:inherit() 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> 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>
@ -109,12 +108,12 @@ or you can do the same thing with a seperate class of weapons. Set name to &quot
</tr> </tr>
<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="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 class="doc"><p><a href="../class/Gun.html#lvl1_fields.consts">constants</a> which define gun attributes and should not be changed in an instance of the gun</p>
</td> </td>
</tr> </tr>
<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="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">offsets</a>. runtime storage of offsets generated by recoil sway wag or any other element.</p> <td class="doc"><p>runtime storage of <a href="../class/Gun.html#lvl1_fields.offsets">offsets</a> generated by recoil sway wag or any other element.</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -188,13 +187,19 @@ or you can do the same thing with a seperate class of weapons. Set name to &quot
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="name"><var id="gun.gun_translation">gun_translation</var><a class="permalink" href="#gun.gun_translation" title="Permalink to this definition"></a></td>
<td class="doc"><p><code>vec3</code> translation of the gun relative to the &quot;gun&quot; bone or the player axial rotation.</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="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 class="doc"><p><code>vector</code> containing the offset from animations, this will be generated if {@consts.ANIMATIONS_OFFSET_AIM}=true</p>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="name"><var id="gun.total_offsets">total_offsets</var><a class="permalink" href="#gun.total_offsets" title="Permalink to this definition"></a></td> <td class="name"><var id="gun.gun_axial">gun_axial</var><a class="permalink" href="#gun.gun_axial" 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 class="doc"><p>total offsets of the gun in the same format as a <a href="../class/Gun.html#gun.offsets">an offset</a>
[[total_offsets = {</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -653,11 +658,15 @@ this means that increasing it decreases the time it takes for the angular veloci
<a class="permalink" href="#lvl1_fields.offsets" title="Permalink to this definition"></a> <a class="permalink" href="#lvl1_fields.offsets" title="Permalink to this definition"></a>
</h2> </h2>
<div class="inner"> <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> <p>a list of tables each containing offset vectors These are required for automatic initialization of offsets.</p>
<h5>Example</h5> <h5>Example</h5>
<pre><code class="language-lua">recoil = { <pre><code class="language-lua">recoil = {
gun_axial = {x=0, y=0} gun_axial = {x=0, y=0}, --rotation of the gun around it's origin
player_axial = {x=0, y=0} player_axial = {x=0, y=0}, --rotation of the gun around the bone it's attached to
--translations of gun
player_trans = {x=0, y=0, z=0}, --translation of the bone the gun is attached to
eye_trans = {x=0, y=0, z=0}, --trnaslation of the player's look
gun_tran = {x=0, y=0, z=0}s --translation of the gun relative to the bone it's attachted to.
} }
</code></pre> </code></pre>

View File

@ -0,0 +1,108 @@
<!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="class-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="../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="#player_model_handler">Class <code>player_model_handler</code></a></li>
<li><a href="#fields"><p>player_model_handler fields</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/player_model_handler.html">Player_model_handler.player_model_handler</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>
</ul>
</div>
</div>
<div class="body">
<div class="section">
<h2 class="class" id="player_model_handler">Class <code>player_model_handler</code>
<a class="permalink" href="#player_model_handler" title="Permalink to this definition"></a>
</h2>
<div class="inner">
<p>player_model_handler</p>
<h2>defining the player model when holding a gun</h2>
<p>each player model should have a &quot;gun holding equivelant&quot;. There are numerous reasons for this
first and foremost is that because Minetest is a [redacted mindless insults].
because of this you cannot unset bone offsets and return to normal animations.
Bone offsets are needed for the arms to aim at the gun there's no simple way around this fact.
Since every model is different custom behavior has to be defined for most.</p>
<div class="synopsis">
<table class="functions compact">
<tr>
<td class="name"><var id="player_model.construct">player_model.construct</var>(<em>def</em>)<a class="permalink" href="#player_model.construct" title="Permalink to this definition"></a></td>
<td class="doc"></td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<h2 class="table" id="fields">player_model_handler fields
<a class="permalink" href="#fields" 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="#fields.offsets"><var>offsets</var></a></td>
<td class="doc"><p><a href="../class/player_model_handler.html#fields.offsets">fields.offsets</a></p>
</td>
</tr>
</table>
</div>
<dl class="fields">
<dt id="fields.offsets">
<span class="icon"></span><var>fields.offsets</var>
<a class="permalink" href="#fields.offsets" title="Permalink to this definition"></a>
</dt>
<dd>
<p><a href="../class/player_model_handler.html#fields.offsets">fields.offsets</a></p>
</dd>
</dl>
</div>
</div>
</div>
<script src="../prism.js?7653a2d"></script>
</body>
</html>

View File

@ -6,7 +6,7 @@
<title>Search - Guns4d</title> <title>Search - Guns4d</title>
<link href="prism.css?7653a2d" rel="stylesheet" /> <link href="prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="luadox.css?7653a2d" type="text/css"> <link rel="stylesheet" href="luadox.css?7653a2d" type="text/css">
</head> </head>
<body class="search-search"> <body class="search-search">
<div class="topbar"> <div class="topbar">
@ -16,7 +16,7 @@
<div class="group two"> <div class="group two">
</div> </div>
<div class="group three"> <div class="group three">
<div class="button iconright"><a href="class/mtul.class.new_class.html" title="mtul.class.new_class"><span>Next</span><img src="img/i-right.svg?7653a2d" alt=""/></a></div> <div class="button iconright"><a href="class/player_model_handler.html" title="player_model_handler"><span>Next</span><img src="img/i-right.svg?7653a2d" alt=""/></a></div>
</div> </div>
</div> </div>
<div class="sidebar"> <div class="sidebar">
@ -27,7 +27,7 @@
<div class="heading">Classes</div> <div class="heading">Classes</div>
<ul> <ul>
<li><a href="class/Gun.html">Gun.Gun</a></li> <li><a href="class/Gun.html">Gun.Gun</a></li>
<li><a href="class/mtul.class.new_class.html">mtul.class.new_class.mtul.class.new_class</a></li> <li><a href="class/player_model_handler.html">Player_model_handler.player_model_handler</a></li>
</ul> </ul>
</div> </div>
<div class="modules"> <div class="modules">
@ -37,7 +37,6 @@
<li><a href="module/play_sound.html">play_sound</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/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="module/Control_handler.html">Control_handler</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> </ul>
</div> </div>
</div> </div>

View File

@ -1,11 +1,10 @@
var docs = [ 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/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 therefore are created with the :inherit(def) method, where def is the definition of your new gun- or rather the changed parts of it. So to make a new gun you can run Guns4d.gun:inherit() or you can do the same thing with a seperate class of weapons. Set name to \"__template\" for template classes of guns."},
{path:"class/mtul.class.new_class.html", type:"class", title:"mtul.class.new_class.mtul.class.new_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:"class/player_model_handler.html", type:"class", title:"Player_model_handler.player_model_handler", text:"player_model_handler defining the player model when holding a gun each player model should have a \"gun holding equivelant\". There are numerous reasons for this first and foremost is that because Minetest is a [redacted mindless insults]. because of this you cannot unset bone offsets and return to normal animations. Bone offsets are needed for the arms to aim at the gun there's no simple way around this fact. Since every model is different custom behavior has to be defined for most."},
{path:"module/misc_helpers.html", type:"module", title:"misc_helpers", text:""}, {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/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/Bullet_hole.html", type:"module", title:"Bullet_hole", text:""},
{path:"module/Control_handler.html", type:"module", title:"Control_handler", 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.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.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.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"},
@ -15,8 +14,8 @@ var docs = [
{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.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:"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.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.consts", type:"field", title:"gun.consts", text:"constants 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:"offsets. runtime storage of offsets generated by recoil sway wag or any other element."}, {path:"class/Gun.html#gun.offsets", type:"field", title:"gun.offsets", text:"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.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.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.gun_entity", type:"field", title:"gun.gun_entity", text:"ObjRef the gun entity"},
@ -31,6 +30,7 @@ var docs = [
{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.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.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#gun.muzzle_flash", type:"field", title:"gun.muzzle_flash", text:"function"},
{path:"class/Gun.html#gun.gun_translation", type:"field", title:"gun.gun_translation", text:"vec3 translation of the gun relative to the \"gun\" bone or the player axial rotation."},
{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.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.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.firemodes", type:"field", title:"lvl1_fields.properties.firemodes", text:"table list of firemodes"},
@ -95,7 +95,7 @@ var docs = [
{path:"class/Gun.html#lvl1_fields.offsets.breathing", type:"field", title:"lvl1_fields.offsets.breathing", 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", type:"field", title:"lvl1_fields.offsets.look", text:""}, {path:"class/Gun.html#lvl1_fields.offsets.look", type:"field", title:"lvl1_fields.offsets.look", 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.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_offsets", type:"field", title:"gun.total_offsets", text:"total offsets of the gun in the same format as a an offset"}, {path:"class/Gun.html#gun.gun_axial", type:"field", title:"gun.gun_axial", text:"total offsets of the gun in the same format as a an offset [[total_offsets = {"},
{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.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.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_MAX_HEAR_DISTANCE", type:"field", title:"lvl1_fields.consts.DEFAULT_MAX_HEAR_DISTANCE", text:"default max hear distance when not specified"},
@ -112,18 +112,14 @@ var docs = [
{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.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_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/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/mtul.class.new_class.html#god_work.instance", type:"field", title:"god_work.instance", text:"defines wether the object is an instance"}, {path:"class/player_model_handler.html#fields.offsets", type:"field", title:"fields.offsets", text:"fields.offsets"},
{path:"class/mtul.class.new_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/mtul.class.new_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/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.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.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/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/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:"module/Control_handler.html#controls.toggle_touchscreen_mode", type:"function", title:"controls:toggle_touchscreen_mode", text:""},
{path:"class/mtul.class.new_class.html#mtul.class.new_class.inherit", type:"function", title:"mtul.class.new_class:inherit", text:"creates a new base class. Calls all constructors in the chain with def.instance=true"}, {path:"class/player_model_handler.html#player_model.construct", type:"function", title:"player_model.construct", text:""},
{path:"class/mtul.class.new_class.html#mtul.class.new_class.new", type:"function", title:"mtul.class.new_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#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#table", type:"section", title:"table helpers", text:"in guns4d.table"},
{path:"module/misc_helpers.html#other", type:"section", title:"other helpers", text:""}, {path:"module/misc_helpers.html#other", type:"section", title:"other helpers", text:""},

View File

@ -6,7 +6,7 @@
<title>Bullet_hole - Guns4d</title> <title>Bullet_hole - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" /> <link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css"> <link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head> </head>
<body class="module-bullet_hole"> <body class="module-bullet_hole">
<div class="topbar"> <div class="topbar">
@ -34,7 +34,7 @@
<div class="heading">Classes</div> <div class="heading">Classes</div>
<ul> <ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li> <li><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/mtul.class.new_class.html">mtul.class.new_class.mtul.class.new_class</a></li> <li><a href="../class/player_model_handler.html">Player_model_handler.player_model_handler</a></li>
</ul> </ul>
</div> </div>
<div class="modules"> <div class="modules">
@ -44,7 +44,6 @@
<li><a href="../module/play_sound.html">play_sound</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 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/Control_handler.html">Control_handler</a></li>
<li><a href="../module/Player_model_handler.html">Player_model_handler</a></li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -6,7 +6,7 @@
<title>Control_handler - Guns4d</title> <title>Control_handler - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" /> <link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css"> <link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head> </head>
<body class="module-control_handler"> <body class="module-control_handler">
<div class="topbar"> <div class="topbar">
@ -17,7 +17,6 @@
</div> </div>
<div class="group three"> <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 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> </div>
<div class="sidebar"> <div class="sidebar">
@ -34,7 +33,7 @@
<div class="heading">Classes</div> <div class="heading">Classes</div>
<ul> <ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li> <li><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/mtul.class.new_class.html">mtul.class.new_class.mtul.class.new_class</a></li> <li><a href="../class/player_model_handler.html">Player_model_handler.player_model_handler</a></li>
</ul> </ul>
</div> </div>
<div class="modules"> <div class="modules">
@ -44,7 +43,6 @@
<li><a href="../module/play_sound.html">play_sound</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/Bullet_hole.html">Bullet_hole</a></li>
<li class="selected"><a href="../module/Control_handler.html">Control_handler</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> </ul>
</div> </div>
</div> </div>

View File

@ -6,7 +6,7 @@
<title>misc_helpers - Guns4d</title> <title>misc_helpers - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" /> <link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css"> <link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head> </head>
<body class="module-misc_helpers"> <body class="module-misc_helpers">
<div class="topbar"> <div class="topbar">
@ -16,7 +16,7 @@
<div class="group two"> <div class="group two">
</div> </div>
<div class="group three"> <div class="group three">
<div class="button iconleft"><a href="../class/mtul.class.new_class.html" title="mtul.class.new_class"><img src="../img/i-left.svg?7653a2d" alt=""/><span>Previous</span></a></div> <div class="button iconleft"><a href="../class/player_model_handler.html" title="player_model_handler"><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 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> </div>
@ -40,7 +40,7 @@
<div class="heading">Classes</div> <div class="heading">Classes</div>
<ul> <ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li> <li><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/mtul.class.new_class.html">mtul.class.new_class.mtul.class.new_class</a></li> <li><a href="../class/player_model_handler.html">Player_model_handler.player_model_handler</a></li>
</ul> </ul>
</div> </div>
<div class="modules"> <div class="modules">
@ -50,7 +50,6 @@
<li><a href="../module/play_sound.html">play_sound</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/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="../module/Control_handler.html">Control_handler</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> </ul>
</div> </div>
</div> </div>

View File

@ -6,7 +6,7 @@
<title>play_sound - Guns4d</title> <title>play_sound - Guns4d</title>
<link href="../prism.css?7653a2d" rel="stylesheet" /> <link href="../prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css"> <link rel="stylesheet" href="../luadox.css?7653a2d" type="text/css">
</head> </head>
<body class="module-play_sound"> <body class="module-play_sound">
<div class="topbar"> <div class="topbar">
@ -36,7 +36,7 @@
<div class="heading">Classes</div> <div class="heading">Classes</div>
<ul> <ul>
<li><a href="../class/Gun.html">Gun.Gun</a></li> <li><a href="../class/Gun.html">Gun.Gun</a></li>
<li><a href="../class/mtul.class.new_class.html">mtul.class.new_class.mtul.class.new_class</a></li> <li><a href="../class/player_model_handler.html">Player_model_handler.player_model_handler</a></li>
</ul> </ul>
</div> </div>
<div class="modules"> <div class="modules">
@ -46,7 +46,6 @@
<li class="selected"><a href="../module/play_sound.html">play_sound</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/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="../module/Control_handler.html">Control_handler</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> </ul>
</div> </div>
</div> </div>

View File

@ -6,7 +6,7 @@
<title>Search - Guns4d</title> <title>Search - Guns4d</title>
<link href="prism.css?7653a2d" rel="stylesheet" /> <link href="prism.css?7653a2d" rel="stylesheet" />
<link rel="stylesheet" href="luadox.css?7653a2d" type="text/css"> <link rel="stylesheet" href="luadox.css?7653a2d" type="text/css">
</head> </head>
<body class="search-search"> <body class="search-search">
<div class="topbar"> <div class="topbar">
@ -16,7 +16,7 @@
<div class="group two"> <div class="group two">
</div> </div>
<div class="group three"> <div class="group three">
<div class="button iconright"><a href="class/mtul.class.new_class.html" title="mtul.class.new_class"><span>Next</span><img src="img/i-right.svg?7653a2d" alt=""/></a></div> <div class="button iconright"><a href="class/player_model_handler.html" title="player_model_handler"><span>Next</span><img src="img/i-right.svg?7653a2d" alt=""/></a></div>
</div> </div>
</div> </div>
<div class="sidebar"> <div class="sidebar">
@ -27,7 +27,7 @@
<div class="heading">Classes</div> <div class="heading">Classes</div>
<ul> <ul>
<li><a href="class/Gun.html">Gun.Gun</a></li> <li><a href="class/Gun.html">Gun.Gun</a></li>
<li><a href="class/mtul.class.new_class.html">mtul.class.new_class.mtul.class.new_class</a></li> <li><a href="class/player_model_handler.html">Player_model_handler.player_model_handler</a></li>
</ul> </ul>
</div> </div>
<div class="modules"> <div class="modules">
@ -37,7 +37,6 @@
<li><a href="module/play_sound.html">play_sound</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/Bullet_hole.html">Bullet_hole</a></li>
<li><a href="module/Control_handler.html">Control_handler</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> </ul>
</div> </div>
</div> </div>

View File

@ -84,7 +84,6 @@ local objref_mtable
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local pname = player:get_player_name() local pname = player:get_player_name()
Guns4d.players[pname] = player_handler:new({player=player}) --player handler does just what it sounds like- see classes/Player_handler Guns4d.players[pname] = player_handler:new({player=player}) --player handler does just what it sounds like- see classes/Player_handler
Guns4d.handler_by_ObjRef[player] = Guns4d.players[pname] Guns4d.handler_by_ObjRef[player] = Guns4d.players[pname]
--set the FOV to a predictable value --set the FOV to a predictable value
player:set_fov(Guns4d.config.default_fov) player:set_fov(Guns4d.config.default_fov)
@ -174,6 +173,21 @@ minetest.register_on_joinplayer(function(player)
end end
return old_remove(self) return old_remove(self)
end end
--[[minetest.after(1, function(playername)
minetest.get_player_by_name(playername):hud_add({
hud_elem_type = "compass",
text = "gun_mrkr.png",
scale = {x=1, y=1},
alignment = {x=0,y=0},
position = {x=.5,y=.5},
size = {x=200, y=200},
offset = {x=-.5,y=.5},
direction = 0
})
end, player:get_player_name())]]
end end
end) end)
--we grab the ObjRef metatable from the first available source. --we grab the ObjRef metatable from the first available source.
@ -202,5 +216,13 @@ minetest.register_globalstep(function(dt)
handler = player_handler:new({player=player}) handler = player_handler:new({player=player})
end end
handler:update(dt) handler:update(dt)
--[[minetest.get_player_by_name(player):hud_add({
hud_elem_type = "compass",
text = "gay.png",
scale = {x=10, y=10},
alignment = {x=0,y=0},
offset = {x=-.5,y=-.5},
direction = 0
})]]
end end
end) end)

View File

@ -85,8 +85,6 @@ function Guns4d.table.deep_copy(tbl, copy_metatable, indexed_tables)
local metat = getmetatable(tbl) local metat = getmetatable(tbl)
if metat then if metat then
if copy_metatable then if copy_metatable then
setmetatable(new_table, Guns4d.table.deep_copy(metat, true))
else
setmetatable(new_table, metat) setmetatable(new_table, metat)
end end
end end

View File

@ -6,28 +6,5 @@ if minetest.get_modpath("3d_armor") then
["3d_armor_character.b3d"] = "guns4d_3d_armor_character.b3d" ["3d_armor_character.b3d"] = "guns4d_3d_armor_character.b3d"
}, },
}) })
--custom bone orientations...
--[[function armor3d_handler:update_aiming()
--gun bones:
local player = self.player
local handler = self.handler
local gun = handler.gun
local first, _ = player:get_eye_offset()
local pprops = handler:get_properties()
local eye_pos = vector.new(0, (pprops.eye_height*10)/pprops.visual_size.y, 0)+vector.divide(first, pprops.visual_size)
if handler.control_handler.ads then
eye_pos.x = ((handler.horizontal_offset*10)/pprops.visual_size.x) --horizontal_offset already is eye_offset on x
end
local player_axial_offset = gun.total_offsets.player_axial
player:set_bone_position(self.bone_aliases.hipfire, self.offsets.relative.arm_right, {x=-player_axial_offset.x-gun.player_rotation.x, y=180-player_axial_offset.y, z=0})
--print(self.offsets.global.arm_right)
--player:set_bone_position(self.bone_aliases.reticle, eye_pos, vector.new(combined.x, 180-combined.y, 0))
--can't use paxial dir as it needs to be relative on Y still.
local dir = vector.rotate(gun.local_paxial_dir, {x=gun.player_rotation.x*math.pi/180,y=0,z=0})
local rot = vector.dir_to_rotation(dir)*180/math.pi
--irrlicht uses clockwise rotations, while everything else seemingly uses counter-clockwise. MMM yes, it's an "engine" not sphaghetti
player:set_bone_position(self.bone_aliases.aim, eye_pos, {x=rot.x,y=180-rot.y,z=0})
end]]
armor3d_handler:set_default_handler() armor3d_handler:set_default_handler()
end end