Changed default for realistic_items to false, changed default pellet behavior to penetrate walls but have no deviation, cleanup
This commit is contained in:
parent
aa29c79311
commit
01ee029c73
@ -34,8 +34,9 @@ minetest.register_on_mods_loaded(function()
|
|||||||
behavior_type = "ignore"
|
behavior_type = "ignore"
|
||||||
end
|
end
|
||||||
if groups.leaves then
|
if groups.leaves then
|
||||||
RHA = .0001
|
--RHA = .0001
|
||||||
random_deviation = .005
|
--random_deviation = .005
|
||||||
|
behavior_type = "ignore"
|
||||||
end
|
end
|
||||||
if groups.stone then
|
if groups.stone then
|
||||||
RHA = 1/groups.stone
|
RHA = 1/groups.stone
|
||||||
|
@ -194,6 +194,7 @@ function Ammo_handler:load_single_cartridge()
|
|||||||
bullet = v:get_name()
|
bullet = v:get_name()
|
||||||
v:take_item(1)
|
v:take_item(1)
|
||||||
inv:set_stack("main", i, v)
|
inv:set_stack("main", i, v)
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if bullet then
|
if bullet then
|
||||||
|
@ -49,21 +49,21 @@ local ray = {
|
|||||||
spread = 0, --defaults to 1 if pellets present but spread not defined.
|
spread = 0, --defaults to 1 if pellets present but spread not defined.
|
||||||
pellets = 1,
|
pellets = 1,
|
||||||
wall_penetration = true, --turns off by default if pellets are greater then one.
|
wall_penetration = true, --turns off by default if pellets are greater then one.
|
||||||
ITERATION_DISTANCE = Guns4d.config.default_penetration_iteration_distance,
|
iteration_distance = Guns4d.config.default_penetration_iteration_distance,
|
||||||
}
|
}
|
||||||
|
|
||||||
--find (valid) edge. Slabs or other nodeboxes that are not the last hit position are not considered (to account for holes) TODO: update to account for hollow nodes
|
--find (valid) edge. Slabs or other nodeboxes that are not the last hit position are not considered (to account for holes) TODO: update to account for hollow nodes
|
||||||
function ray:find_transverse_edge()
|
function ray:find_transverse_edge()
|
||||||
assert(self.instance, "attempt to call obj method on a class")
|
assert(self.instance, "attempt to call obj method on a class")
|
||||||
local pointed
|
local pointed
|
||||||
local cast1 = minetest.raycast(self.pos+(self.dir*(self.ITERATION_DISTANCE+.001)), self.pos, false, false)
|
local cast1 = minetest.raycast(self.pos+(self.dir*(self.iteration_distance+.001)), self.pos, false, false)
|
||||||
for hit in cast1 do
|
for hit in cast1 do
|
||||||
--we can't solidly predict all nodes, so ignore them as the distance will be solved regardless. If node name is different then
|
--we can't solidly predict all nodes, so ignore them as the distance will be solved regardless. If node name is different then
|
||||||
if hit.type == "node" and (vector.distance(hit.intersection_point, self.pos) > 0.0001) and (vector.equals(hit.under, self.last_pointed_node.under) or not minetest.registered_nodes[self.last_node_name].node_box) then
|
if hit.type == "node" and (vector.distance(hit.intersection_point, self.pos) > 0.0001) and (vector.equals(hit.under, self.last_pointed_node.under) or not minetest.registered_nodes[self.last_node_name].node_box) then
|
||||||
pointed = hit
|
pointed = hit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (pointed) and (vector.distance(pointed.intersection_point, self.pos) < self.ITERATION_DISTANCE) then
|
if (pointed) and (vector.distance(pointed.intersection_point, self.pos) < self.iteration_distance) then
|
||||||
return pointed.intersection_point, pointed.intersection_normal
|
return pointed.intersection_point, pointed.intersection_normal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -82,7 +82,7 @@ function ray:cast()
|
|||||||
end_pos = edge+(self.dir*.001) --give it a tolerance, it still needs to intersect with any node edges connected to the edge's block.
|
end_pos = edge+(self.dir*.001) --give it a tolerance, it still needs to intersect with any node edges connected to the edge's block.
|
||||||
next_state = "free"
|
next_state = "free"
|
||||||
else
|
else
|
||||||
end_pos = self.pos+(self.dir*self.ITERATION_DISTANCE)
|
end_pos = self.pos+(self.dir*self.iteration_distance)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
end_pos = self.pos+(self.dir*self.range)
|
end_pos = self.pos+(self.dir*self.range)
|
||||||
@ -420,6 +420,9 @@ function ray.construct(def)
|
|||||||
if rawget(def, "spread") == nil then
|
if rawget(def, "spread") == nil then
|
||||||
def.spread = 1
|
def.spread = 1
|
||||||
end
|
end
|
||||||
|
if rawget(def, "iteration_distance") == nil then
|
||||||
|
def.iteration_distance = 10
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--blunt pen is in the same units (1 Joule/Area^3 = 1 Pa), so we use it to make the ratio by subtraction.
|
--blunt pen is in the same units (1 Joule/Area^3 = 1 Pa), so we use it to make the ratio by subtraction.
|
||||||
local init_def = def.init_def
|
local init_def = def.init_def
|
||||||
|
@ -19,6 +19,10 @@ local gun_default = {
|
|||||||
firerateRPM = 600, -- used by update() and by extent fire() + default controls. The firerate of the gun. Rounds per minute
|
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"
|
burst = 3, -- how many rounds in burst using when firemode is at "burst"
|
||||||
ammo_handler = Ammo_handler,
|
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},
|
||||||
|
selectionbox = {-.1,-.1,-.1, .1,.1,.1}
|
||||||
|
},
|
||||||
hip = {
|
hip = {
|
||||||
offset = Vec.new(),
|
offset = Vec.new(),
|
||||||
sway_vel_mul = 5,
|
sway_vel_mul = 5,
|
||||||
@ -270,8 +274,8 @@ local gun_default = {
|
|||||||
ANIMATIONS_OFFSET_AIM = false,
|
ANIMATIONS_OFFSET_AIM = false,
|
||||||
LOOP_IDLE_ANIM = false,
|
LOOP_IDLE_ANIM = false,
|
||||||
THIRD_PERSON_GAIN_MULTIPLIER = Guns4d.config.third_person_gain_multiplier,
|
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_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, .1,.2,.2},
|
--ITEM_SELECTIONBOX = {-.2,-.2,-.2, .2,.2,.2},
|
||||||
},
|
},
|
||||||
--[[animation_data = { --where animations data is stored.
|
--[[animation_data = { --where animations data is stored.
|
||||||
anim_runtime = 0,
|
anim_runtime = 0,
|
||||||
|
@ -79,10 +79,6 @@ local function initialize_animation(self)
|
|||||||
self.animation_rotation = vector.new()
|
self.animation_rotation = vector.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--========================== MAIN INSTANCE CONSTRUCTOR ===============================
|
|
||||||
|
|
||||||
|
|
||||||
function gun_default:construct_instance()
|
function gun_default:construct_instance()
|
||||||
assert(self.handler, "no player handler object provided")
|
assert(self.handler, "no player handler object provided")
|
||||||
|
|
||||||
@ -113,7 +109,6 @@ function gun_default:construct_instance()
|
|||||||
if self.custom_construct then self:custom_construct() end
|
if self.custom_construct then self:custom_construct() end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -233,8 +228,8 @@ local function reregister_item(self, props)
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
Guns4d.register_item(self.itemstring, {
|
Guns4d.register_item(self.itemstring, {
|
||||||
collisionbox = self.consts.ITEM_COLLISIONBOX,
|
collisionbox = self.properties.item.collisionbox,
|
||||||
selectionbox = self.consts.ITEM_SELECTIONBOX,
|
selectionbox = self.properties.item.selectionbox,
|
||||||
mesh = self.properties.visuals.mesh,
|
mesh = self.properties.visuals.mesh,
|
||||||
textures = self.properties.visuals.textures,
|
textures = self.properties.visuals.textures,
|
||||||
animation = self.properties.visuals.animations.loaded
|
animation = self.properties.visuals.animations.loaded
|
||||||
|
2
init.lua
2
init.lua
@ -30,7 +30,7 @@ Guns4d.config = {
|
|||||||
default_penetration_iteration_distance = .25,
|
default_penetration_iteration_distance = .25,
|
||||||
maximum_bullet_holes = 20,
|
maximum_bullet_holes = 20,
|
||||||
--enable_assert = false,
|
--enable_assert = false,
|
||||||
realistic_items = true
|
realistic_items = false
|
||||||
--`["official_content.replace_ads_with_bloom"] = false,
|
--`["official_content.replace_ads_with_bloom"] = false,
|
||||||
--`["official_content.uses_magazines"] = true
|
--`["official_content.uses_magazines"] = true
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user