Skip to content

Commit

Permalink
major recoil changes (wrong branch...), documented properties
Browse files Browse the repository at this point in the history
  • Loading branch information
FatalistError committed Jun 25, 2024
1 parent 9d3f1ea commit 8279359
Show file tree
Hide file tree
Showing 47 changed files with 3,001 additions and 1,855 deletions.
2 changes: 1 addition & 1 deletion ammo_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion classes/Ammo_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
457 changes: 315 additions & 142 deletions classes/Gun.lua

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions classes/Instantiatable_class.lua
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion classes/Player_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions classes/gun_construct.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand All @@ -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
11 changes: 0 additions & 11 deletions docs/config.ld

This file was deleted.

3 changes: 0 additions & 3 deletions docs/guns4d_doc_gen/config.guns4d

This file was deleted.

50 changes: 0 additions & 50 deletions docs/guns4d_doc_gen/init.lua

This file was deleted.

13 changes: 0 additions & 13 deletions docs/install_and_build_docs

This file was deleted.

Binary file added docs/luadox/luadox
Binary file not shown.
28 changes: 28 additions & 0 deletions docs/luadox/luadox.conf
Original file line number Diff line number Diff line change
@@ -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 changes: 4 additions & 0 deletions docs/luadox/run.bat
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 8279359

Please sign in to comment.