fixed arm jittering
@ -61,6 +61,11 @@ minetest.register_on_mods_loaded(function()
|
|||||||
--random_deviation = .1
|
--random_deviation = .1
|
||||||
behavior_type = "ignore"
|
behavior_type = "ignore"
|
||||||
end
|
end
|
||||||
|
--"rolled homogenous armor"
|
||||||
|
if behavior_type=="ignore" then
|
||||||
|
RHA=0
|
||||||
|
random_deviation=0
|
||||||
|
end
|
||||||
Guns4d.node_properties[i] = {mmRHA=RHA*1000, random_deviation=random_deviation, behavior=behavior_type}
|
Guns4d.node_properties[i] = {mmRHA=RHA*1000, random_deviation=random_deviation, behavior=behavior_type}
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -1062,12 +1062,10 @@ function gun_default:update_animation_rotation()
|
|||||||
out = vector.new(self.b3d_model.global_frames.rotation[frame1]:to_euler_angles_unpack())*180/math.pi
|
out = vector.new(self.b3d_model.global_frames.rotation[frame1]:to_euler_angles_unpack())*180/math.pi
|
||||||
--print("rawsent")
|
--print("rawsent")
|
||||||
else --to stop nan
|
else --to stop nan
|
||||||
local ip_ratio = current_frame-frame1
|
local ip_ratio = (current_frame-frame1)/(frame2-frame1)
|
||||||
local vec1 = self.b3d_model.global_frames.rotation[frame1]
|
local vec1 = self.b3d_model.global_frames.rotation[frame1]
|
||||||
local vec2 = self.b3d_model.global_frames.rotation[frame2]
|
local vec2 = self.b3d_model.global_frames.rotation[frame2]
|
||||||
out = vector.new(vec1:slerp(vec2, ip_ratio):to_euler_angles_unpack())*180/math.pi
|
out = vector.new(vec1:slerp(vec2, ip_ratio):to_euler_angles_unpack())*180/math.pi
|
||||||
--out = vec1+((vec1-vec2)*ip_ratio) --they're euler angles... actually I wouldnt think this works, but it's good enough for my purposes.
|
|
||||||
--print("interpolated")
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
out = vector.copy(self.b3d_model.global_frames.rotation[1])
|
out = vector.copy(self.b3d_model.global_frames.rotation[1])
|
||||||
@ -1083,8 +1081,8 @@ end
|
|||||||
local out = {arm_left=vector.new(), arm_right=vector.new()}
|
local out = {arm_left=vector.new(), arm_right=vector.new()}
|
||||||
function gun_default:get_arm_aim_pos()
|
function gun_default:get_arm_aim_pos()
|
||||||
local current_frame = self.animation_data.current_frame+1
|
local current_frame = self.animation_data.current_frame+1
|
||||||
local frame1 = (math.floor(current_frame)/self.consts.KEYFRAME_SAMPLE_PRECISION)
|
local frame1 = math.floor(current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION)
|
||||||
local frame2 = (math.floor(current_frame)/self.consts.KEYFRAME_SAMPLE_PRECISION)+1
|
local frame2 = math.floor(current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION)+1
|
||||||
current_frame = current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION
|
current_frame = current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION
|
||||||
|
|
||||||
for i, v in pairs(out) do
|
for i, v in pairs(out) do
|
||||||
@ -1093,9 +1091,10 @@ function gun_default:get_arm_aim_pos()
|
|||||||
if (not self.b3d_model.global_frames[i][frame2]) or (current_frame==frame1) then
|
if (not self.b3d_model.global_frames[i][frame2]) or (current_frame==frame1) then
|
||||||
out[i] = vector.copy(self.b3d_model.global_frames[i][frame1])
|
out[i] = vector.copy(self.b3d_model.global_frames[i][frame1])
|
||||||
else --to stop nan
|
else --to stop nan
|
||||||
local ip_ratio = current_frame-frame1
|
local ip_ratio = (current_frame-frame1)/(frame2-frame1)
|
||||||
local vec1 = self.b3d_model.global_frames[i][frame1]
|
local vec1 = self.b3d_model.global_frames[i][frame1]
|
||||||
local vec2 = self.b3d_model.global_frames[i][frame2]
|
local vec2 = self.b3d_model.global_frames[i][frame2]
|
||||||
|
print(current_frame, frame1, frame2, ip_ratio)
|
||||||
out[i] = vec1+((vec1-vec2)*ip_ratio)
|
out[i] = vec1+((vec1-vec2)*ip_ratio)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -110,7 +110,6 @@ 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
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
@ -282,6 +281,7 @@ function gun_default:construct_base_class()
|
|||||||
for _, v in pairs(self.properties.ammo.accepted_magazines) do
|
for _, v in pairs(self.properties.ammo.accepted_magazines) do
|
||||||
self.accepted_magazines[v] = true
|
self.accepted_magazines[v] = true
|
||||||
end
|
end
|
||||||
|
self.properties = mtul.class.proxy_table:new(self.properties)
|
||||||
|
|
||||||
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
|
register_visual_entity(self, props) --register the visual entity
|
||||||
|
75
guide_book.lua
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
local show_guide
|
||||||
|
minetest.register_tool("guns4d:guide_book", {
|
||||||
|
description = "mysterious gun related manual",
|
||||||
|
inventory_image = "guns4d_guide.png",
|
||||||
|
on_use = function(itemstack, player, pointed)
|
||||||
|
show_guide(player,1)
|
||||||
|
end,
|
||||||
|
on_place = function(itemstack, player, pointed_thing)
|
||||||
|
if pointed_thing and (pointed_thing.type == "node") then
|
||||||
|
local pname = player:get_player_name()
|
||||||
|
local node = minetest.get_node(pointed_thing.under).name
|
||||||
|
local props = Guns4d.node_properties[node]
|
||||||
|
if props.behavior~="ignore" then
|
||||||
|
minetest.chat_send_player(pname, math.ceil(props.mmRHA).."mm of \"Rolled Homogenous Armor\" per meter")
|
||||||
|
minetest.chat_send_player(pname, (math.ceil(props.random_deviation*100)/100).."° of deviation per meter")
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(pname, "bullets pass through this block like air")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
local pages = {
|
||||||
|
--first page, diagram of m4 and controls
|
||||||
|
"\
|
||||||
|
size[7.5,10.5]\
|
||||||
|
image[0,0;7.5,10.5;guns4d_guide_cover.png]\
|
||||||
|
",
|
||||||
|
"\
|
||||||
|
size[15,10.5]\
|
||||||
|
image[0,0;15,10.5;m4_diagram_text_en.png]\
|
||||||
|
image[0,0;15,10.5;m4_diagram_overlay.png]\
|
||||||
|
",
|
||||||
|
"\
|
||||||
|
size[15,10.5]\
|
||||||
|
image[0,0;15,10.5;guns4d_guide_page_2.png]\
|
||||||
|
"
|
||||||
|
--
|
||||||
|
}
|
||||||
|
function show_guide(player, page)
|
||||||
|
player:hud_set_flags({wielditem=false})
|
||||||
|
local form = pages[page]
|
||||||
|
form = "\
|
||||||
|
formspec_version[6]\
|
||||||
|
"..form
|
||||||
|
if page==1 then
|
||||||
|
form=form.."\
|
||||||
|
button[5.5,9.5;.7,.5;page_next;next]"
|
||||||
|
else
|
||||||
|
form=form.."\
|
||||||
|
image[0,0;15,10.5;page_crinkles.png]\
|
||||||
|
button[13.75,9.75;.7,.5;page_next;next]\
|
||||||
|
button[.6,9.75;.7,.5;page_back;back]\
|
||||||
|
field[5.6,9.8;.7,.5;page_number;page;"..page.."]\
|
||||||
|
field_close_on_enter[page_number;false]\
|
||||||
|
label[6.25,10.05; /"..#pages.."]"
|
||||||
|
end
|
||||||
|
--button[<X>,<Y>;<W>,<H>;page_turn;<label>]\
|
||||||
|
--field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]
|
||||||
|
|
||||||
|
minetest.show_formspec(player:get_player_name(), "guns4d:guide", form)
|
||||||
|
end
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if formname == "guns4d:guide" then
|
||||||
|
if (fields.page_number and tonumber(fields.page_number)) or not fields.page_number then
|
||||||
|
fields.page_number = fields.page_number or 1
|
||||||
|
local num = tonumber(fields.page_number)+((fields.page_next and 1) or (fields.page_back and -1) or 0)
|
||||||
|
show_guide(player,
|
||||||
|
(pages[num] and num) or ((num > 1) and #pages) or 1
|
||||||
|
)
|
||||||
|
end
|
||||||
|
if fields.quit then
|
||||||
|
player:hud_set_flags({wielditem=true})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
1
init.lua
@ -60,6 +60,7 @@ dofile(modpath.."/default_controls.lua")
|
|||||||
dofile(modpath.."/touch_support.lua")
|
dofile(modpath.."/touch_support.lua")
|
||||||
dofile(modpath.."/block_values.lua")
|
dofile(modpath.."/block_values.lua")
|
||||||
dofile(modpath.."/ammo_api.lua")
|
dofile(modpath.."/ammo_api.lua")
|
||||||
|
dofile(modpath.."/guide_book.lua")
|
||||||
local path = modpath .. "/classes"
|
local path = modpath .. "/classes"
|
||||||
dofile(path.."/Bullet_hole.lua")
|
dofile(path.."/Bullet_hole.lua")
|
||||||
dofile(path.."/Bullet_ray.lua")
|
dofile(path.."/Bullet_ray.lua")
|
||||||
|
BIN
textures/guns4d_guide.png
Normal file
After Width: | Height: | Size: 411 B |
BIN
textures/guns4d_guide_cover.png
Normal file
After Width: | Height: | Size: 37 KiB |
227
textures/guns4d_guide_cover.svg
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
width="600"
|
||||||
|
height="840"
|
||||||
|
viewBox="0 0 600 840"
|
||||||
|
sodipodi:docname="guns4d_guide_cover.svg"
|
||||||
|
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
||||||
|
inkscape:export-filename="guns4d_guide_cover.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<rect
|
||||||
|
x="39.986777"
|
||||||
|
y="79.973554"
|
||||||
|
width="500.94545"
|
||||||
|
height="82.195041"
|
||||||
|
id="rect1" />
|
||||||
|
<filter
|
||||||
|
inkscape:menu="Shadows and Glows"
|
||||||
|
inkscape:menu-tooltip="Cut out, add inner shadow and colorize some parts of an image"
|
||||||
|
style="color-interpolation-filters:sRGB;"
|
||||||
|
inkscape:label="Drop Shadow"
|
||||||
|
id="filter54"
|
||||||
|
x="-0.022969412"
|
||||||
|
y="-0.27313864"
|
||||||
|
width="1.0504782"
|
||||||
|
height="1.6002572">
|
||||||
|
<feColorMatrix
|
||||||
|
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.21 0.72 0.07 0 0 "
|
||||||
|
result="result1"
|
||||||
|
id="feColorMatrix49" />
|
||||||
|
<feColorMatrix
|
||||||
|
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 2 0 "
|
||||||
|
result="result9"
|
||||||
|
id="feColorMatrix50" />
|
||||||
|
<feComposite
|
||||||
|
in2="result9"
|
||||||
|
in="SourceGraphic"
|
||||||
|
operator="in"
|
||||||
|
result="result4"
|
||||||
|
id="feComposite50" />
|
||||||
|
<feFlood
|
||||||
|
result="result2"
|
||||||
|
flood-color="rgb(0,0,0)"
|
||||||
|
id="feFlood50" />
|
||||||
|
<feComposite
|
||||||
|
in2="result9"
|
||||||
|
operator="in"
|
||||||
|
result="result10"
|
||||||
|
id="feComposite51" />
|
||||||
|
<feComposite
|
||||||
|
in2="result4"
|
||||||
|
operator="atop"
|
||||||
|
id="feComposite52" />
|
||||||
|
<feGaussianBlur
|
||||||
|
stdDeviation="3"
|
||||||
|
result="result8"
|
||||||
|
id="feGaussianBlur52" />
|
||||||
|
<feOffset
|
||||||
|
dx="3"
|
||||||
|
dy="3"
|
||||||
|
result="result3"
|
||||||
|
in="result8"
|
||||||
|
id="feOffset52" />
|
||||||
|
<feFlood
|
||||||
|
flood-opacity="1"
|
||||||
|
flood-color="rgb(219,173,62)"
|
||||||
|
result="result5"
|
||||||
|
id="feFlood52" />
|
||||||
|
<feMerge
|
||||||
|
result="result6"
|
||||||
|
id="feMerge54">
|
||||||
|
<feMergeNode
|
||||||
|
in="result5"
|
||||||
|
id="feMergeNode52" />
|
||||||
|
<feMergeNode
|
||||||
|
in="result3"
|
||||||
|
id="feMergeNode53" />
|
||||||
|
<feMergeNode
|
||||||
|
in="result4"
|
||||||
|
id="feMergeNode54" />
|
||||||
|
</feMerge>
|
||||||
|
<feComposite
|
||||||
|
in2="SourceGraphic"
|
||||||
|
operator="in"
|
||||||
|
result="fbSourceGraphic"
|
||||||
|
id="feComposite54" />
|
||||||
|
<feColorMatrix
|
||||||
|
result="fbSourceGraphicAlpha"
|
||||||
|
in="fbSourceGraphic"
|
||||||
|
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
|
||||||
|
id="feColorMatrix132" />
|
||||||
|
<feFlood
|
||||||
|
id="feFlood132"
|
||||||
|
result="flood"
|
||||||
|
in="fbSourceGraphic"
|
||||||
|
flood-opacity="1.000000"
|
||||||
|
flood-color="rgb(62,43,3)" />
|
||||||
|
<feGaussianBlur
|
||||||
|
id="feGaussianBlur132"
|
||||||
|
result="blur"
|
||||||
|
in="fbSourceGraphic"
|
||||||
|
stdDeviation="0.800000" />
|
||||||
|
<feOffset
|
||||||
|
id="feOffset132"
|
||||||
|
result="offset"
|
||||||
|
in="blur"
|
||||||
|
dx="-1.000000"
|
||||||
|
dy="-1.000000" />
|
||||||
|
<feComposite
|
||||||
|
id="feComposite132"
|
||||||
|
result="comp1"
|
||||||
|
operator="out"
|
||||||
|
in="flood"
|
||||||
|
in2="offset" />
|
||||||
|
<feComposite
|
||||||
|
id="feComposite133"
|
||||||
|
result="comp2"
|
||||||
|
operator="atop"
|
||||||
|
in="comp1"
|
||||||
|
in2="fbSourceGraphic" />
|
||||||
|
</filter>
|
||||||
|
<rect
|
||||||
|
x="39.986777"
|
||||||
|
y="79.973554"
|
||||||
|
width="500.94545"
|
||||||
|
height="82.195041"
|
||||||
|
id="rect133" />
|
||||||
|
<rect
|
||||||
|
x="39.986777"
|
||||||
|
y="79.973554"
|
||||||
|
width="500.94545"
|
||||||
|
height="82.195041"
|
||||||
|
id="rect134" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#eeeeee"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:showpageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#505050"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="0.63660655"
|
||||||
|
inkscape:cx="262.32843"
|
||||||
|
inkscape:cy="388.78016"
|
||||||
|
inkscape:window-width="1536"
|
||||||
|
inkscape:window-height="801"
|
||||||
|
inkscape:window-x="-8"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg1">
|
||||||
|
<inkscape:grid
|
||||||
|
id="grid1"
|
||||||
|
units="px"
|
||||||
|
originx="0"
|
||||||
|
originy="0"
|
||||||
|
spacingx="1"
|
||||||
|
spacingy="1"
|
||||||
|
empcolor="#0099e5"
|
||||||
|
empopacity="0.30196078"
|
||||||
|
color="#0099e5"
|
||||||
|
opacity="0.14901961"
|
||||||
|
empspacing="40"
|
||||||
|
dotted="true"
|
||||||
|
gridanglex="30"
|
||||||
|
gridanglez="30"
|
||||||
|
visible="false" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<g
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
inkscape:label="Image"
|
||||||
|
id="g1"
|
||||||
|
sodipodi:insensitive="true">
|
||||||
|
<image
|
||||||
|
width="600"
|
||||||
|
height="840"
|
||||||
|
preserveAspectRatio="none"
|
||||||
|
style="image-rendering:optimizeSpeed"
|
||||||
|
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAVCAYAAACZm7S3AAAAsElEQVQ4EeWUQRLCIAxFIcWjuPcM 3v9Ajq0gLyU1Llw0LM1MBwj/kZBmyNfbvaVuUi5JZEm1vlh+mfkZt+dDdWsfCypAzIOtVvWpf8zY R1u3VT0l99O88CDc5Ne+OM3p6T/BVsDQnbPsWAgmMg0TgomsDXP65w4gHBl+KjIHhO6sYLRgwFg4 8tSdp6pN2qWN14EFnWOtx9obkUgVDd+Rtj0rBiLENDWqOsBOdPDzxr0BJWlMrDNt7JwAAAAASUVO RK5CYII= "
|
||||||
|
id="image1"
|
||||||
|
x="0"
|
||||||
|
y="0" />
|
||||||
|
</g>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
id="text1"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:42.6667px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect1);display:inline;fill:#000000;fill-opacity:1;stroke:none;filter:url(#filter54)"
|
||||||
|
transform="matrix(1,0,0,1.1513546,14.439669,1.8597261)"><tspan
|
||||||
|
x="39.986328"
|
||||||
|
y="119.54806"
|
||||||
|
id="tspan3"><tspan
|
||||||
|
style="font-family:'Britannic Bold';-inkscape-font-specification:'Britannic Bold, ';fill:#f9c923"
|
||||||
|
id="tspan2">Basic Weapons Handling</tspan></tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
id="text133"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:42.6667px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect133);display:inline;fill:#c98e09;fill-opacity:1;stroke:none;filter:url(#filter54)"
|
||||||
|
transform="translate(14.439669,65.12004)"><tspan
|
||||||
|
x="39.986328"
|
||||||
|
y="119.54806"
|
||||||
|
id="tspan5"><tspan
|
||||||
|
style="font-family:'Britannic Bold';-inkscape-font-specification:'Britannic Bold, '"
|
||||||
|
id="tspan4">First edition</tspan></tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
id="text134"
|
||||||
|
style="font-style:normal;font-weight:normal;font-size:29.3333px;line-height:1.25;font-family:sans-serif;white-space:pre;shape-inside:url(#rect134);display:inline;fill:#c98e09;fill-opacity:1;stroke:none;filter:url(#filter54)"
|
||||||
|
transform="translate(14.439669,636.90177)"><tspan
|
||||||
|
x="39.986328"
|
||||||
|
y="107.18069"
|
||||||
|
id="tspan7"><tspan
|
||||||
|
style="font-family:'Britannic Bold';-inkscape-font-specification:'Britannic Bold, '"
|
||||||
|
id="tspan6">author: Fatalist Error</tspan></tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 7.1 KiB |
BIN
textures/guns4d_guide_page_2.png
Normal file
After Width: | Height: | Size: 216 KiB |
BIN
textures/m4_diagram_overlay.png
Normal file
After Width: | Height: | Size: 163 KiB |
BIN
textures/m4_diagram_text_en.png
Normal file
After Width: | Height: | Size: 118 KiB |
BIN
textures/page_crinkles.png
Normal file
After Width: | Height: | Size: 511 B |