added sprite scope functionality, added magnification and new system for FOV through ObjRef metatable (with locking), etc.
This commit is contained in:
parent
e80a4a4242
commit
181d228a16
@ -44,7 +44,6 @@ function Dynamic_crosshair:update(dt)
|
||||
|
||||
for offset, v in pairs(gun.offsets) do
|
||||
if (offset ~= "walking" or not self.normalize_walking) and (offset ~= "breathing" or not self.normalize_breathing) and (offset ~= "sway" or not self.normalize_sway) then
|
||||
print(offset)
|
||||
temp_vector = temp_vector + absolute_vector(v.player_axial) + absolute_vector(v.gun_axial)
|
||||
end
|
||||
end
|
||||
|
103
classes/Gun.lua
103
classes/Gun.lua
@ -7,6 +7,7 @@ local gun_default = {
|
||||
registered = {},
|
||||
property_modifiers = {},
|
||||
properties = {
|
||||
magnification = 1,
|
||||
hip = { --used by gun entity (attached offset)
|
||||
offset = Vec.new(),
|
||||
sway_vel_mul = 5, --these are multipliers for various attributes. Does support fractional vals (which can be useful if you want to make hipfire more random with spread.)
|
||||
@ -89,6 +90,7 @@ local gun_default = {
|
||||
},
|
||||
visuals = {
|
||||
--mesh
|
||||
root = "gun",
|
||||
arm_right = "right_aimpoint",
|
||||
arm_left = "left_aimpoint",
|
||||
animations = { --used by animations handler for idle, and default controls
|
||||
@ -119,8 +121,9 @@ local gun_default = {
|
||||
breathing = {
|
||||
gun_axial = Vec.new(), --gun axial unimplemented...
|
||||
player_axial = Vec.new(),
|
||||
}
|
||||
},
|
||||
},
|
||||
animation_rotation = vector.new(),
|
||||
spread = {
|
||||
|
||||
},
|
||||
@ -145,17 +148,18 @@ local gun_default = {
|
||||
AIM_OUT_AIM_IN_SPEED_RATIO = 2.5,
|
||||
HIPFIRE_BONE = "guns3d_hipfire_bone", --these shouldn't be here at all, these need to be model determinant.
|
||||
AIMING_BONE = "guns3d_aiming_bone",
|
||||
KEYFRAME_SAMPLE_PRECISION = 1, --[[what frequency to take precalcualted keyframe samples. The lower this is the higher the memory allocation it will need- though minimal.
|
||||
KEYFRAME_SAMPLE_PRECISION = .1, --[[what frequency to take precalcualted keyframe samples. The lower this is the higher the memory allocation it will need- though minimal.
|
||||
This will fuck shit up if you change it after gun construction/inheritence (interpolation between precalculated vectors will not work right)]]
|
||||
WAG_CYCLE_SPEED = 1.6,
|
||||
DEFAULT_FPS = 60,
|
||||
WAG_DECAY = 1, --divisions per second
|
||||
HAS_RECOIL = true,
|
||||
HAS_BREATHING = true,
|
||||
HAS_SWAY = true,
|
||||
HAS_WAG = true,
|
||||
WAG_CYCLE_SPEED = 1.6,
|
||||
WAG_DECAY = 1, --divisions per second
|
||||
HAS_GUN_AXIAL_OFFSETS = true,
|
||||
ANIMATIONS_OFFSET_AIM = false,
|
||||
INFINITE_AMMO_IN_CREATIVE = true,
|
||||
DEFAULT_FPS = 60,
|
||||
LOOP_IDLE_ANIM = false
|
||||
},
|
||||
animation_data = { --where animations data is stored.
|
||||
@ -176,6 +180,7 @@ local gun_default = {
|
||||
rechamber_time = 0,
|
||||
muzzle_flash = Guns4d.effects.muzzle_flash
|
||||
}
|
||||
--I dont remember why I made this, used it though lmao
|
||||
function gun_default.multiplier_coefficient(multiplier, ratio)
|
||||
return 1+((multiplier*ratio)-ratio)
|
||||
end
|
||||
@ -257,7 +262,6 @@ function gun_default:attempt_fire()
|
||||
})
|
||||
Guns4d.bullet_ray:new(bullet_def)
|
||||
if self.properties.visuals.animations.fire then
|
||||
minetest.chat_send_all(dump(self.properties.visuals.animations.fire))
|
||||
self:set_animation(self.properties.visuals.animations.fire, nil, false)
|
||||
end
|
||||
self:recoil()
|
||||
@ -508,6 +512,8 @@ function gun_default:update_animation(dt)
|
||||
if data.loop and (data.current_frame > data.frames.y) then
|
||||
data.current_frame = data.frames.x
|
||||
end
|
||||
--track rotations
|
||||
if self.consts.ANIMATIONS_OFFSET_AIM then self:update_animation_rotation() end
|
||||
end
|
||||
--IMPORTANT!!! this does not directly modify the animation_data table, it's all hooked through ObjRef:set_animation() (init.lua) so if animation is set elsewhere it doesnt break.
|
||||
--this may be deprecated in the future- as it is no longer really needed now that I hook ObjRef functions.
|
||||
@ -532,13 +538,10 @@ function gun_default:clear_animation()
|
||||
elseif self.ammo_handler.ammo.total_bullets > 0 then
|
||||
loaded = true
|
||||
end
|
||||
minetest.chat_send_all(tostring(loaded))
|
||||
minetest.chat_send_all(self.ammo_handler.ammo.loaded_mag)
|
||||
local data = self.animation_data
|
||||
if loaded then
|
||||
self.entity:set_animation({x=self.properties.visuals.animations.loaded.x, y=self.properties.visuals.animations.loaded.y}, 0, 0, self.consts.LOOP_IDLE_ANIM)
|
||||
else
|
||||
minetest.chat_send_all(self.properties.visuals.animations.empty.x)
|
||||
self.entity:set_animation({x=self.properties.visuals.animations.empty.x, y=self.properties.visuals.animations.empty.y}, 0, 0, self.consts.LOOP_IDLE_ANIM)
|
||||
end
|
||||
end
|
||||
@ -582,26 +585,57 @@ function gun_default:update_sway(dt)
|
||||
end
|
||||
end
|
||||
|
||||
--this needs to save results eventually. Shouldn't be particularly important though. <-not sure what the fuck I meant by that
|
||||
function gun_default:update_animation_rotation()
|
||||
local current_frame = self.animation_data.current_frame
|
||||
local frame1 = math.floor(current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION)
|
||||
local frame2 = math.floor(current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION)+1
|
||||
current_frame = current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION
|
||||
local out
|
||||
if self.b3d_model.global_frames.rotation then
|
||||
if self.b3d_model.global_frames.rotation[frame1] then
|
||||
if (not self.b3d_model.global_frames.rotation[frame2]) or (current_frame==frame1) then
|
||||
out = vector.copy(self.b3d_model.global_frames.rotation[frame1])
|
||||
else --to stop nan
|
||||
local ip_ratio = current_frame-frame1
|
||||
local vec1 = self.b3d_model.global_frames.rotation[frame1]
|
||||
local vec2 = self.b3d_model.global_frames.rotation[frame2]
|
||||
out = vec1+((vec1-vec2)*ip_ratio)
|
||||
end
|
||||
else
|
||||
out = vector.copy(self.b3d_model.global_frames.rotation[1])
|
||||
end
|
||||
else
|
||||
out = vector.new()
|
||||
end
|
||||
self.animation_rotation = out
|
||||
--minetest.chat_send_all(dump(out))
|
||||
--minetest.chat_send_all(self.animation_data.current_frame)
|
||||
end
|
||||
|
||||
--relative to the gun's entity. Returns left, right vectors.
|
||||
local out = {arm_left=vector.new(), arm_right=vector.new()}
|
||||
function gun_default:get_arm_aim_pos()
|
||||
local current_frame = self.animation_data.current_frame
|
||||
local frame1 = math.floor(current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION)
|
||||
local frame2 = math.floor(current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION)+1
|
||||
current_frame = current_frame/self.consts.KEYFRAME_SAMPLE_PRECISION
|
||||
|
||||
for i, v in pairs(out) do
|
||||
if self.b3d_model.global_frames[i][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])
|
||||
else --to stop nan
|
||||
local ip_ratio = (current_frame-frame1)/self.consts.KEYFRAME_SAMPLE_PRECISION
|
||||
local vec1 = self.b3d_model.global_frames[i][frame1]
|
||||
local vec2 = self.b3d_model.global_frames[i][frame2]
|
||||
out[i] = vec1+((vec1-vec2)*ip_ratio)
|
||||
if self.b3d_model.global_frames[i] then
|
||||
if self.b3d_model.global_frames[i][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])
|
||||
else --to stop nan
|
||||
local ip_ratio = current_frame-frame1
|
||||
local vec1 = self.b3d_model.global_frames[i][frame1]
|
||||
local vec2 = self.b3d_model.global_frames[i][frame2]
|
||||
out[i] = vec1+((vec1-vec2)*ip_ratio)
|
||||
end
|
||||
else
|
||||
out[i]=vector.copy(self.b3d_model.global_frames[i][1])
|
||||
end
|
||||
else
|
||||
out[i]=vector.copy(self.b3d_model.global_frames[i][1])
|
||||
out[i] = vector.new()
|
||||
end
|
||||
end
|
||||
return out.arm_left, out.arm_right
|
||||
@ -669,7 +703,7 @@ gun_default.construct = function(def)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def.animation_rotation = vector.new()
|
||||
--def.velocities = table.deep_copy(def.base_class.velocities)
|
||||
def.velocities = {}
|
||||
for i, tbl in pairs(def.base_class.velocities) do
|
||||
@ -728,11 +762,34 @@ gun_default.construct = function(def)
|
||||
--print(table.tostring(def.b3d_model))
|
||||
--precalculate keyframe "samples" for intepolation.
|
||||
--mildly infuriating that lua just stops short by one (so I have to add one extra) I *think* I get why though.
|
||||
local left = mtul.b3d_nodes.get_node_by_name(def.b3d_model, props.visuals.arm_left, true)
|
||||
local right = mtul.b3d_nodes.get_node_by_name(def.b3d_model, props.visuals.arm_right, true)
|
||||
local main = mtul.b3d_nodes.get_node_by_name(def.b3d_model, props.visuals.root, true)
|
||||
for target_frame = 0, def.b3d_model.node.animation.frames+1, def.consts.KEYFRAME_SAMPLE_PRECISION do
|
||||
table.insert(def.b3d_model.global_frames.arm_right, vector.new(mtul.b3d_nodes.get_node_global_position(def.b3d_model, props.visuals.arm_right, true, target_frame))/10)
|
||||
table.insert(def.b3d_model.global_frames.arm_left, vector.new(mtul.b3d_nodes.get_node_global_position(def.b3d_model, props.visuals.arm_left, true, target_frame))/10)
|
||||
--def.b3d_model.rotation =
|
||||
--we need to check that the bone exists first.
|
||||
if left then
|
||||
table.insert(def.b3d_model.global_frames.arm_left, vector.new(mtul.b3d_nodes.get_node_global_position(def.b3d_model, left, nil, target_frame))/10)
|
||||
else
|
||||
def.b3d_model.global_frames.arm_left = nil
|
||||
end
|
||||
|
||||
if right then
|
||||
table.insert(def.b3d_model.global_frames.arm_right, vector.new(mtul.b3d_nodes.get_node_global_position(def.b3d_model, right, nil, target_frame))/10)
|
||||
else
|
||||
def.b3d_model.global_frames.arm_right = nil
|
||||
end
|
||||
|
||||
if main then
|
||||
--use -1 as it does not exist and thus will always go to the default resting pose
|
||||
local newvec = (mtul.b3d_nodes.get_node_rotation(def.b3d_model, main, nil, -1):inverse())*mtul.b3d_nodes.get_node_rotation(def.b3d_model, main, nil, target_frame)
|
||||
newvec = vector.new(newvec:to_euler_angles_unpack())*180/math.pi
|
||||
--newvec.z = 0
|
||||
table.insert(def.b3d_model.global_frames.rotation, newvec)
|
||||
print(target_frame)
|
||||
print(dump(vector.new(mtul.b3d_nodes.get_node_rotation(def.b3d_model, main, nil, -1):to_euler_angles_unpack())*180/math.pi))
|
||||
end
|
||||
end
|
||||
-- if it's not a template, then create an item, override some props
|
||||
if def.name ~= "__template" then
|
||||
assert(rawget(def, "name"), "no name provided in new class")
|
||||
assert(rawget(def, "itemstring"), "no itemstring provided in new class")
|
||||
|
@ -12,12 +12,12 @@ function Instantiatable_class:inherit(def)
|
||||
--this effectively creates a construction chain by overwriting .construct
|
||||
function def.construct(parameters)
|
||||
--rawget because in a instance it may only be present in a hierarchy but not the table itself
|
||||
if rawget(def, "_construct_low") then
|
||||
def._construct_low(parameters)
|
||||
end
|
||||
if self.construct then
|
||||
self.construct(parameters)
|
||||
end
|
||||
if rawget(def, "_construct_low") then
|
||||
def._construct_low(parameters)
|
||||
end
|
||||
end
|
||||
def.construct(def)
|
||||
--iterate through table properties
|
||||
|
@ -13,6 +13,7 @@ local player_handler = {
|
||||
look_offset = Vec.new(),
|
||||
ads_location = 0, --interpolation scalar for gun aiming location
|
||||
controls = {},
|
||||
default_fov = 80,
|
||||
fov = 80,
|
||||
horizontal_offset = 0
|
||||
}
|
||||
@ -53,7 +54,6 @@ function player_handler:update(dt)
|
||||
player:hud_set_flags({wielditem = false, crosshair = false})
|
||||
|
||||
--for the gun's scopes to work properly we need predictable offsets.
|
||||
player:set_fov(self.fov)
|
||||
end
|
||||
--update some properties.
|
||||
self.look_rotation.x, self.look_rotation.y = math.clamp((player:get_look_vertical() or 0)*180/math.pi, -80, 80), -player:get_look_horizontal()*180/math.pi
|
||||
@ -138,6 +138,15 @@ function player_handler:get_is_walking()
|
||||
end
|
||||
return walking
|
||||
end
|
||||
--allows the gun to set FOV without having to worry about unsetting it
|
||||
function player_handler:set_fov(val, transition)
|
||||
self.fov_lock = true
|
||||
Guns4d.old_set_fov(self.player, val, nil, transition)
|
||||
end
|
||||
function player_handler:unset_fov(transition)
|
||||
self.fov_lock = false
|
||||
Guns4d.old_set_fov(self.player, self.default_fov, nil, transition)
|
||||
end
|
||||
--resets the controls bools table for the player_handler
|
||||
function player_handler:reset_controls_table()
|
||||
assert(self.instance, "attempt to call object method on a class")
|
||||
|
@ -1,26 +1,30 @@
|
||||
local Sprite_scope = Instantiatable_class:inherit({
|
||||
images = {
|
||||
fore = {
|
||||
texture = "blank.png",
|
||||
texture = "scope_fore.png",
|
||||
scale = {x=13,y=13},
|
||||
movement_multiplier = 1,
|
||||
paxial = false,
|
||||
},
|
||||
back = {
|
||||
texture = "blank.png",
|
||||
texture = "scope_back.png",
|
||||
scale = {x=10,y=10},
|
||||
movement_multiplier = -1,
|
||||
opacity_delay = 2,
|
||||
paxial = true,
|
||||
},
|
||||
reticle = {
|
||||
--[[reticle = {
|
||||
texture = "gun_mrkr.png",
|
||||
scale = {x=.5,y=.5},
|
||||
movement_multiplier = 1,
|
||||
misalignment_opacity_threshold_angle = 3,
|
||||
misalignment_opacity_maximum_angle = 8,
|
||||
},
|
||||
},]]
|
||||
--mask = "blank.png",
|
||||
},
|
||||
hide_gun = false,
|
||||
fov_set = false,
|
||||
hide_gun = true,
|
||||
magnification = 4,
|
||||
construct = function(def)
|
||||
if def.instance then
|
||||
assert(def.gun, "no gun instance provided")
|
||||
@ -31,45 +35,52 @@ local Sprite_scope = Instantiatable_class:inherit({
|
||||
if def.images then
|
||||
def.images = table.fill(new_images, def.images)
|
||||
end
|
||||
def.elements.fore = def.player:hud_add{
|
||||
hud_elem_type = "image",
|
||||
position = {x=.5,y=.5},
|
||||
scale = def.images.fore.scale,
|
||||
text = "blank.png",
|
||||
}
|
||||
def.elements.back = def.player:hud_add{
|
||||
hud_elem_type = "image",
|
||||
position = {x=.5,y=.5},
|
||||
scale = def.images.back.scale,
|
||||
text = "blank.png",
|
||||
}
|
||||
def.elements.reticle = def.player:hud_add{
|
||||
hud_elem_type = "image",
|
||||
position = {x=.5,y=.5},
|
||||
scale = def.images.reticle.scale,
|
||||
text = "blank.png",
|
||||
}
|
||||
for i, v in pairs(def.images) do
|
||||
def.elements[i] = def.player:hud_add{
|
||||
hud_elem_type = "image",
|
||||
position = {x=.5,y=.5},
|
||||
scale = v.scale,
|
||||
text = "blank.png",
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
Guns4d.sprite_scope = Sprite_scope
|
||||
--rename to draw?
|
||||
function Sprite_scope:update()
|
||||
local handler = self.handler
|
||||
if handler.wininfo and self.handler.control_bools.ads then
|
||||
if not self.fov_set then
|
||||
self.fov_set = true
|
||||
handler:set_fov(80/self.magnification)
|
||||
end
|
||||
local dir = self.gun.local_dir
|
||||
local ratio = handler.wininfo.size.x/handler.wininfo.size.y
|
||||
local added_pos
|
||||
|
||||
if handler.ads_location ~= 1 then
|
||||
dir = dir + (self.gun.properties.ads.offset+vector.new(self.gun.properties.ads.horizontal_offset,0,0))*0
|
||||
end
|
||||
local fov = self.player:get_fov()
|
||||
local v1 = Point_to_hud(dir, fov, ratio)
|
||||
local v2 = Point_to_hud(self.gun.local_paxial_dir, fov, ratio)
|
||||
self.player:hud_change(self.elements.fore, "position", {x=(v1.x*self.images.fore.movement_multiplier)+.5, y=(v1.y*self.images.fore.movement_multiplier)+.5})
|
||||
self.player:hud_change(self.elements.back, "position", {x=(v2.x*self.images.back.movement_multiplier)+.5, y=(v2.y*self.images.back.movement_multiplier)+.5})
|
||||
self.player:hud_change(self.elements.reticle, "position", {x=(v1.x*self.images.reticle.movement_multiplier)+.5, y=(v1.y*self.images.reticle.movement_multiplier)+.5})
|
||||
--update textures
|
||||
local real_aim = Point_to_hud(dir, fov, ratio)
|
||||
local anim_aim = Point_to_hud(vector.rotate({x=0,y=0,z=1}, self.gun.animation_rotation*math.pi/180), fov, ratio)
|
||||
real_aim.x = real_aim.x+anim_aim.x; real_aim.y = real_aim.y+anim_aim.y
|
||||
|
||||
--print(dump(self.gun.animation_rotation))
|
||||
local paxial_aim = Point_to_hud(self.gun.local_paxial_dir, fov, ratio)
|
||||
--so custom scopes can do their thing without doing more calcs
|
||||
self.hud_projection_real = real_aim
|
||||
self.hud_projection_paxial = paxial_aim
|
||||
for i, v in pairs(self.elements) do
|
||||
if self.images[i].paxial then
|
||||
self.player:hud_change(v, "position", {x=(paxial_aim.x*self.images[i].movement_multiplier)+.5, y=(paxial_aim.y*self.images[i].movement_multiplier)+.5})
|
||||
else
|
||||
self.player:hud_change(v, "position", {x=(real_aim.x*self.images[i].movement_multiplier)+.5, y=(real_aim.y*self.images[i].movement_multiplier)+.5})
|
||||
end
|
||||
end
|
||||
elseif self.fov_set then
|
||||
self.fov_set = false
|
||||
handler:unset_fov()
|
||||
end
|
||||
local angle =math.sqrt(self.gun.total_offset_rotation.gun_axial.x^2+self.gun.total_offset_rotation.gun_axial.y^2)
|
||||
for i, v in pairs(self.elements) do
|
||||
@ -87,6 +98,7 @@ function Sprite_scope:update()
|
||||
end
|
||||
end
|
||||
function Sprite_scope:prepare_deletion()
|
||||
self.handler:unset_fov()
|
||||
for i, v in pairs(self.elements) do
|
||||
self.player:hud_remove(v)
|
||||
end
|
||||
|
20
init.lua
20
init.lua
@ -1,6 +1,7 @@
|
||||
local Vec = vector
|
||||
Guns4d = {
|
||||
players = {},
|
||||
handler_by_ObjRef = {},
|
||||
gun_by_ObjRef = {} --used for getting the gun object by the ObjRef of the gun
|
||||
}
|
||||
local path = minetest.get_modpath("guns4d")
|
||||
@ -31,10 +32,24 @@ minetest.register_on_joinplayer(function(player)
|
||||
Guns4d.players[pname] = {
|
||||
handler = player_handler:new({player=player})
|
||||
}
|
||||
Guns4d.handler_by_ObjRef[player] = Guns4d.players[pname].handler
|
||||
--set the FOV to a predictable value
|
||||
player:set_fov(80)
|
||||
--ObjRef overrides will be integrated into MTUL (eventually TM)
|
||||
if not objref_mtable then
|
||||
objref_mtable = getmetatable(player)
|
||||
print(dump(objref_mtable))
|
||||
|
||||
local old_set_fov = objref_mtable.set_fov
|
||||
Guns4d.old_set_fov = old_set_fov
|
||||
function objref_mtable.set_fov(self, ...)
|
||||
local handler = Guns4d.handler_by_ObjRef[self]
|
||||
if handler then --check, just in case it's not a player (and thus should throw an error)
|
||||
handler.default_fov = select(1, ...)
|
||||
if handler.fov_lock then return end
|
||||
end
|
||||
old_set_fov(self, ...)
|
||||
end
|
||||
|
||||
local old_get_pos = objref_mtable.get_pos
|
||||
function objref_mtable.get_pos(self)
|
||||
@ -55,8 +70,8 @@ minetest.register_on_joinplayer(function(player)
|
||||
local data = gun.animation_data
|
||||
data.runtime = 0
|
||||
data.fps = frame_speed or 15
|
||||
data.loop = frame_loop --still have no idea what nutjob made the default true >:(
|
||||
if frame_loop == nil then
|
||||
data.loop = frame_loop
|
||||
if frame_loop == nil then --still have no idea what nutjob made the default true >:(
|
||||
frame_loop = true
|
||||
end
|
||||
--so... minetest is stupid, and so it won't let me set something to the same animation twice (utterly fucking brilliant).
|
||||
@ -101,6 +116,7 @@ minetest.register_on_leaveplayer(function(player)
|
||||
local pname = player:get_player_name()
|
||||
Guns4d.players[pname].handler:prepare_deletion()
|
||||
Guns4d.players[pname] = nil
|
||||
Guns4d.handler_by_ObjRef[player] = nil
|
||||
end)
|
||||
|
||||
--ticks are rarely used, but still ideal for rare checks with minimal overhead.
|
||||
|
@ -120,7 +120,7 @@ local function parse_index(i)
|
||||
end
|
||||
end
|
||||
--dump() sucks.
|
||||
function table.tostring(tbl, shallow, long_lists, tables, depth)
|
||||
function table.tostring(tbl, shallow, list_length_lim, depth_limit, tables, depth)
|
||||
--create a list of tables that have been tostringed in this chain
|
||||
if not table then return "nil" end
|
||||
if not tables then tables = {this_table = tbl} end
|
||||
@ -131,7 +131,7 @@ function table.tostring(tbl, shallow, long_lists, tables, depth)
|
||||
for i = 1, depth do
|
||||
initial_string = initial_string .. " "
|
||||
end
|
||||
if depth > 20 then
|
||||
if depth > (depth_limit or math.huge) then
|
||||
return "(TABLE): depth limited reached"
|
||||
end
|
||||
local iterations = 0
|
||||
@ -145,7 +145,7 @@ function table.tostring(tbl, shallow, long_lists, tables, depth)
|
||||
--to avoid infinite loops, make sure that the table has not been tostringed yet
|
||||
if not contains then
|
||||
tables[i] = v
|
||||
str = str..initial_string..parse_index(i).." = "..table.tostring(v, shallow, long_lists, tables, depth)..","
|
||||
str = str..initial_string..parse_index(i).." = "..table.tostring(v, shallow, list_length_lim, depth_limit, tables, depth)..","
|
||||
else
|
||||
str = str..initial_string..parse_index(i).." = "..tostring(v).." (index: '"..tostring(contains).."'),"
|
||||
end
|
||||
@ -153,7 +153,7 @@ function table.tostring(tbl, shallow, long_lists, tables, depth)
|
||||
str = str..initial_string..parse_index(i).." = "..tostring(v)..","
|
||||
end
|
||||
end
|
||||
if iterations > 100 and not long_lists then
|
||||
if iterations > (list_length_lim or math.huge) then
|
||||
return "(TABLE): too long, 100+ indices"
|
||||
end
|
||||
return str..string.sub(initial_string, 1, -5).."}"
|
||||
|
Binary file not shown.
BIN
textures/awm_backscope.png
Normal file
BIN
textures/awm_backscope.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 B |
BIN
textures/awm_forescope.png
Normal file
BIN
textures/awm_forescope.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 240 B |
BIN
textures/awm_reticle.png
Normal file
BIN
textures/awm_reticle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
1
textures/awm_reticle.psp
Normal file
1
textures/awm_reticle.psp
Normal file
File diff suppressed because one or more lines are too long
BIN
textures/awm_scope_border.png
Normal file
BIN
textures/awm_scope_border.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 B |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 8.9 KiB |
Loading…
x
Reference in New Issue
Block a user