Skip to content

Commit

Permalink
worked on documentation. Switching to new branch for major documentat…
Browse files Browse the repository at this point in the history
…ion changes
  • Loading branch information
FatalistError committed Jun 19, 2024
1 parent af970be commit 9d3f1ea
Show file tree
Hide file tree
Showing 18 changed files with 192 additions and 303 deletions.
148 changes: 0 additions & 148 deletions autogen_docs/modules/Gun.html

This file was deleted.

112 changes: 0 additions & 112 deletions autogen_docs/scripts/misc_helper.html

This file was deleted.

30 changes: 21 additions & 9 deletions classes/Gun.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
--- Gun class
-- this is the system used to represent guns and their attributes directly.
-- @module Gun
-- @classmod Gun

local Vec = vector
local gun_default = {
Expand All @@ -11,13 +10,18 @@ local gun_default = {
registered = {},
property_modifiers = {},

--ldoc will fuck this up, so fields are handled by external post-generation script.

--- properties
-- the table containing every attribute of the gun.
-- @table properties
properties = {
infinite_inventory_overlay = "inventory_overlay_inf_ammo.png", -- defines the filename to to be used as the overlay on the item when the player has infinite ammo.
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"
--%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,
item = {
collisionbox = ((not Guns4d.config.realistic_items) and {-.1,-.1,-.1, .1,.1,.1}) or {-.1,-.05,-.1, .1,.15,.1},
Expand Down Expand Up @@ -215,6 +219,7 @@ local gun_default = {
--inventory_image_empty
--used by ammo_handler
},
--- offsets
offsets = {
recoil = {
gun_axial = Vec.new(),
Expand Down Expand Up @@ -480,7 +485,7 @@ function gun_default:update_look_rotation(dt)
local player_rot = self.player_rotation
player_rot.y = -handler.look_rotation.y
local rot_factor = Guns4d.config.vertical_rotation_factor*dt
rot_factor = rot_factor*(.5*(1+handler.ads_location))
rot_factor = rot_factor
local next_vert_aim = ((player_rot.x-look_rotation.x)/(1+rot_factor))+look_rotation.x --difference divided by a value and then added back to the original
if math.abs(look_rotation.x-next_vert_aim) > .005 then
player_rot.x = next_vert_aim
Expand All @@ -490,11 +495,18 @@ function gun_default:update_look_rotation(dt)

if not handler.control_handler.ads then
local pitch = self.total_offset_rotation.player_axial.x+player_rot.x
self.offsets.look_snap.gun_axial.x = (pitch*(1-self.consts.HIP_ROTATION_RATIO))+(handler.look_rotation.x-player_rot.x)
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)
else
self.offsets.look_snap.gun_axial.x = 0
self.offsets.look_snap.player_axial.x = 0
--quick little experiment...
--[[local pitch = self.total_offset_rotation.player_axial.x+player_rot.x
self.offsets.look_snap.gun_axial.x = handler.look_rotation.x-player_rot.x
self.offsets.look_snap.player_axial.x = 0]]
end
end
--============================================== positional info =====================================
Expand Down
4 changes: 2 additions & 2 deletions ldoc/config.ld → docs/config.ld
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ backtick_references=false
file = {
"../",
}
dir='../autogen_docs'
dir='./outputted documentation'
readme='../README.md'
style='!new'
style='!new'
3 changes: 3 additions & 0 deletions docs/guns4d_doc_gen/config.guns4d
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
guns4d_classes = {
"Gun"
}
50 changes: 50 additions & 0 deletions docs/guns4d_doc_gen/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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
File renamed without changes.
Loading

0 comments on commit 9d3f1ea

Please sign in to comment.