Big commit

FP camera pos edit
Convar system tweaks
lang tweaks
thrown weapons fixes
inventory prints
HUD improvements
This commit is contained in:
Fesiug 2024-09-27 16:10:50 -04:00
parent 79d9b040f3
commit 780ec39711
Signed by: Fesiug
GPG Key ID: 374BFF45E1EEF243
12 changed files with 326 additions and 158 deletions

View File

@ -29,7 +29,7 @@ else
if ent:IsValid() then if ent:IsValid() then
ent:SetPredictable( false ) ent:SetPredictable( false )
print("CL Stopping prediction on", ent) print("[prediction] cl stop:", ent)
end end
end) end)
end end
@ -73,7 +73,7 @@ function ENT:Think()
net.Start("Benny_ItemSlept") net.Start("Benny_ItemSlept")
net.WriteEntity(self) net.WriteEntity(self)
net.Broadcast() net.Broadcast()
print("SV Stopping prediction on", self) print("[prediction] sv stop:", self)
--self:SetCollisionGroup( COLLISION_GROUP_WEAPON ) --self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
self.BAsleep = true self.BAsleep = true
end end

View File

@ -109,10 +109,9 @@ else
local ent = net.ReadEntity() local ent = net.ReadEntity()
if ent:IsValid() then if ent:IsValid() then
ent:SetPredictable( net.ReadBool() ) ent:SetPredictable( net.ReadBool() )
print("Starting prediction on", ent) print("[prediction] cl prediction start:", ent)
else else
print("Tried to make an ent predictable but it wasn't valid.") print("[prediction] cl tried to predict invalid ent")
debug.Trace()
end end
end) end)
end end
@ -122,14 +121,13 @@ function SWEP:EquipItem( ent )
if CLIENT then print("FUCK OFF") debug.Trace() return end if CLIENT then print("FUCK OFF") debug.Trace() return end
if IsValid(ent) and ent.BennyItem then if IsValid(ent) and ent.BennyItem then
if ent:GetOwner() != NULL then if ent:GetOwner() != NULL then
print( ent, "belongs to", ent:GetOwner(), "!! Not equipping." ) print( "[equip]", ent, "belongs to", ent:GetOwner(), "not equipping" )
return
elseif p:GetInventory()[ent] then
print( "[equip]", ent, "already belongs to", p )
return return
end end
if p:GetInventory()[ent] then print("[equip]", ent)
print( ent, "is in", p, "'s inventory!" )
return
end
print("Pick up", ent)
self:SetDesireR( ent ) self:SetDesireR( ent )
@ -162,7 +160,7 @@ function SWEP:DropItem()
local p = self:GetOwner() local p = self:GetOwner()
local ent = self:GetActiveR() local ent = self:GetActiveR()
if ent:IsValid() then if ent:IsValid() then
if CLIENT then print("DropItem called on CLIENT but certain things aren't finished yet.") return end if CLIENT then print("[drop] DropItem called on cl not allowed") return end
self:SetDesireR( NULL ) self:SetDesireR( NULL )

View File

@ -3,13 +3,13 @@
-- Your Name is Benny -- Your Name is Benny
--------------------- ---------------------
local cam_f = CreateConVar( "b-cam_f", -75 ) BENNY.AddConvar( "cam_f", -75 )
local cam_r = CreateConVar( "b-cam_r", 12 ) BENNY.AddConvar( "cam_r", 12 )
local cam_u = CreateConVar( "b-cam_u", 12 ) BENNY.AddConvar( "cam_u", 12 )
local cam_fov = CreateConVar( "b-cam_fov", 75 ) BENNY.AddConvar( "cam_fov", 75 )
local cam_fp = CreateConVar( "b-cam_fp", 0 ) BENNY.AddConvar( "cam_fp", 0 )
local cam_fp_fov = CreateConVar( "b-cam_fp_fov", 75 ) BENNY.AddConvar( "cam_fp_fov", 75 )
local lastfp local lastfp
local m = 3 local m = 3
@ -24,13 +24,13 @@ function CamSpot( ang, pos )
local f, r, u = TPSOverride:Forward(), TPSOverride:Right(), TPSOverride:Up() local f, r, u = TPSOverride:Forward(), TPSOverride:Right(), TPSOverride:Up()
local tr = { local tr = {
start = pos, start = pos,
endpos = pos + (f*cam_f:GetFloat()) + (r*cam_r:GetFloat()) + (u*cam_u:GetFloat()), endpos = pos + (f*c_cam_f:GetFloat()) + (r*c_cam_r:GetFloat()) + (u*c_cam_u:GetFloat()),
filter = LocalPlayer(), -- ply, filter = LocalPlayer(), -- ply,
mins = m1, mins = m1,
maxs = m2, maxs = m2,
} }
if cam_fp:GetBool() then if c_cam_fp:GetBool() then
tr.endpos = EyePos() tr.endpos = LocalPlayer():EyePos()
end end
tr = util.TraceHull(tr) tr = util.TraceHull(tr)
return tr.HitPos return tr.HitPos
@ -49,9 +49,9 @@ function QConvert( fovDegrees )
end end
function GM:PreDrawViewModels() function GM:PreDrawViewModels()
local fp = cam_fp:GetBool() local fp = c_cam_fp:GetBool()
if fp then if fp then
cam.Start3D( nil, nil, QConvert( cam_fp_fov:GetFloat() ) ) cam.Start3D( nil, nil, QConvert( c_cam_fp_fov:GetFloat() ) )
cam.IgnoreZ( true ) cam.IgnoreZ( true )
local p = LocalPlayer() local p = LocalPlayer()
p.IWantDraw = true p.IWantDraw = true
@ -67,7 +67,7 @@ function GM:PreDrawViewModels()
end end
function GM:PrePlayerDraw( ply, flags ) function GM:PrePlayerDraw( ply, flags )
local fp = cam_fp:GetBool() local fp = c_cam_fp:GetBool()
if fp and ply == LocalPlayer() and !ply.IWantDraw then if fp and ply == LocalPlayer() and !ply.IWantDraw then
return true return true
end end
@ -77,15 +77,16 @@ function GM:CalcView( ply, pos, ang, fov )
local view = { local view = {
origin = CamSpot(TPSOverride), -- pos includes the smoothstair offset which looks stupid here origin = CamSpot(TPSOverride), -- pos includes the smoothstair offset which looks stupid here
angles = TPSOverride, angles = TPSOverride,
fov = cam_fov:GetFloat(), fov = c_cam_fov:GetFloat(),
drawviewer = true drawviewer = true
} }
local fp = cam_fp:GetBool() local fp = c_cam_fp:GetBool()
if fp then if fp then
ply:SetupBones() ply:SetupBones()
local bm = ply:GetBoneMatrix(ply:LookupBone("DEF-spine.006")) local bm = ply:GetBoneMatrix(ply:LookupBone("DEF-spine.003"))
view.origin = bm:GetTranslation() view.origin = bm:GetTranslation()
view.origin:Add( vector_up*10 )
if ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_end_handgun") then if ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_end_handgun") then
local progress = ply:GetLayerCycle( GESTURE_SLOT_JUMP ) local progress = ply:GetLayerCycle( GESTURE_SLOT_JUMP )
@ -145,7 +146,7 @@ hook.Add( "OnRequestFullUpdate", "Benny_OnRequestFullUpdate_CameraFP", function(
if CLIENT then if CLIENT then
local ply = LocalPlayer() local ply = LocalPlayer()
if !ply:IsValid() then return end if !ply:IsValid() then return end
local fp = cam_fp:GetBool() local fp = c_cam_fp:GetBool()
if lastfp == nil then lastfp = !fp end if lastfp == nil then lastfp = !fp end
timer.Simple( 0, function() timer.Simple( 0, function()
if !fp then if !fp then

View File

@ -3,15 +3,14 @@
-- Your Name is Benny -- Your Name is Benny
--------------------- ---------------------
Convars = {} function BENNY.AddConvar( name, value, flags, mins, maxs )
local CV = CreateConVar( "b-" .. name, value, flags, l8( "#Convar." .. name .. ".Description" ), mins, maxs )
Convars.List = {} _G["c_" .. name] = CV
-- print( "Created Convar: " .. name .. " : " .. l8( "#Convar." .. name .. ".Name" ) .. " : " .. l8( "#Convar." .. name .. ".Description" ) )
function Convars:Add( name, def, help, mins, max ) return CV
end end
function Convars:GetVector() function BENNY.AddClientConvar( name, value, flags, mins, maxs )
local exploded = string.Explode( " ", "" ) if SERVER then return end
return Vector() return BENNY.AddConvar( name, value, flags, mins, maxs )
end end

View File

@ -5,20 +5,20 @@ BennyGame = BennyGame or {}
BG_GTYPE_CAMPAIGN = 0 BG_GTYPE_CAMPAIGN = 0
BG_GTYPE_MP = 1 BG_GTYPE_MP = 1
local cGametype = CreateConVar("b-gametype", 1, nil, "0 for Campaign, 1 for MP") BENNY.AddConvar("gametype", 1)
local cGamemode = CreateConVar("b-gamemode", "dom", nil, "") BENNY.AddConvar("gamemode", "dom")
local cMinplayers = CreateConVar("b-g_minplayers", 2) BENNY.AddConvar("g_minplayers", 2)
local cPregame = CreateConVar("b-g_pregame", 15) BENNY.AddConvar("g_pregame", 15)
local cPostgame = CreateConVar("b-g_postgame", 15) BENNY.AddConvar("g_postgame", 15)
local cIntermission = CreateConVar("b-g_intermission", 10) BENNY.AddConvar("g_intermission", 10)
function BennyGame:GetType() function BennyGame:GetType()
return cGametype:GetBool() and BG_GTYPE_MP or BG_GTYPE_CAMPAIGN return c_gametype:GetBool() and BG_GTYPE_MP or BG_GTYPE_CAMPAIGN
end end
function BennyGame:GetMode() function BennyGame:GetMode()
return cGamemode:GetString() return c_gamemode:GetString()
end end
function BennyGame:GetModeData() function BennyGame:GetModeData()
@ -45,52 +45,52 @@ BennyGame.Gamemodes = {
name = "#Gamemode.tdm.Name", name = "#Gamemode.tdm.Name",
description = "#Gamemode.tdm.Description", description = "#Gamemode.tdm.Description",
scorelimit = CreateConVar("b-g_tdm_scorelimit", 75 ), scorelimit = BENNY.AddConvar("g_tdm_scorelimit", 75 ),
timelimit = CreateConVar("b-g_tdm_timelimit", 10*60 ), timelimit = BENNY.AddConvar("g_tdm_timelimit", 10*60 ),
}, },
["ffa"] = { ["ffa"] = {
name = "#Gamemode.ffa.Name", name = "#Gamemode.ffa.Name",
description = "#Gamemode.ffa.Description", description = "#Gamemode.ffa.Description",
scorelimit = CreateConVar("b-g_ffa_scorelimit", 30 ), scorelimit = BENNY.AddConvar("g_ffa_scorelimit", 30 ),
timelimit = CreateConVar("b-g_ffa_timelimit", 10*60 ), timelimit = BENNY.AddConvar("g_ffa_timelimit", 10*60 ),
}, },
["snd"] = { ["snd"] = {
name = "#Gamemode.snd.Name", name = "#Gamemode.snd.Name",
description = "#Gamemode.snd.Description", description = "#Gamemode.snd.Description",
scorelimit = CreateConVar("b-g_snd_scorelimit", 6 ), scorelimit = BENNY.AddConvar("g_snd_scorelimit", 6 ),
timelimit = CreateConVar("b-g_snd_timelimit", 2.5*60 ), timelimit = BENNY.AddConvar("g_snd_timelimit", 2.5*60 ),
}, },
["ctf"] = { ["ctf"] = {
name = "#Gamemode.ctf.Name", name = "#Gamemode.ctf.Name",
description = "#Gamemode.ctf.Description", description = "#Gamemode.ctf.Description",
scorelimit = CreateConVar("b-g_ctf_scorelimit", 3 ), scorelimit = BENNY.AddConvar("g_ctf_scorelimit", 3 ),
timelimit = CreateConVar("b-g_ctf_timelimit", 10*60 ), timelimit = BENNY.AddConvar("g_ctf_timelimit", 10*60 ),
}, },
["dom"] = { ["dom"] = {
name = "#Gamemode.dom.Name", name = "#Gamemode.dom.Name",
description = "#Gamemode.dom.Description", description = "#Gamemode.dom.Description",
scorelimit = CreateConVar("b-g_dom_scorelimit", 1000 ), scorelimit = BENNY.AddConvar("g_dom_scorelimit", 1000 ),
timelimit = CreateConVar("b-g_dom_timelimit", 10*60 ), timelimit = BENNY.AddConvar("g_dom_timelimit", 10*60 ),
roundlimit = CreateConVar("b-g_dom_roundlimit", 1 ), roundlimit = BENNY.AddConvar("g_dom_roundlimit", 1 ),
}, },
["dem"] = { ["dem"] = {
name = "#Gamemode.dem.Name", name = "#Gamemode.dem.Name",
description = "#Gamemode.dem.Description", description = "#Gamemode.dem.Description",
scorelimit = CreateConVar("b-g_dem_scorelimit", 3 ), scorelimit = BENNY.AddConvar("g_dem_scorelimit", 3 ),
timelimit = CreateConVar("b-g_dem_timelimit", 5*60 ), timelimit = BENNY.AddConvar("g_dem_timelimit", 5*60 ),
roundlimit = CreateConVar("b-g_dom_roundlimit", 2 ), roundlimit = BENNY.AddConvar("g_dom_roundlimit", 2 ),
}, },
["hp"] = { ["hp"] = {
name = "#Gamemode.hp.Name", name = "#Gamemode.hp.Name",
description = "#Gamemode.hp.Description", description = "#Gamemode.hp.Description",
scorelimit = CreateConVar("b-g_hp_scorelimit", 300 ), scorelimit = BENNY.AddConvar("g_hp_scorelimit", 300 ),
timelimit = CreateConVar("b-g_hp_timelimit", 10*60 ), timelimit = BENNY.AddConvar("g_hp_timelimit", 10*60 ),
}, },
} }
@ -159,6 +159,7 @@ hook.Add("InitPostEntity", "Benny_Gamestate_InitPostEntity", function()
BennyGame:Accessor( "Round", "Int", 1 ) BennyGame:Accessor( "Round", "Int", 1 )
BennyGame:Accessor( "SwappedAtRound", "Int", 1 ) BennyGame:Accessor( "SwappedAtRound", "Int", 1 )
BennyGame:Accessor( "TimeExtension", "Int", 0 ) BennyGame:Accessor( "TimeExtension", "Int", 0 )
BennyGame:Accessor( "UUID", "Int", 0 )
BennyGame:Accessor( "Team1_Score", "Int", 0 ) BennyGame:Accessor( "Team1_Score", "Int", 0 )
BennyGame:Accessor( "Team2_Score", "Int", 0 ) BennyGame:Accessor( "Team2_Score", "Int", 0 )
@ -168,6 +169,10 @@ hook.Add("InitPostEntity", "Benny_Gamestate_InitPostEntity", function()
BennyGame:Accessor( "Team6_Score", "Int", 0 ) BennyGame:Accessor( "Team6_Score", "Int", 0 )
BennyGame:Accessor( "TeamsSwapped", "Bool", false ) BennyGame:Accessor( "TeamsSwapped", "Bool", false )
if SERVER then
BennyGame:SetUUID( math.random( -(2^31), (2^31)-1 ) )
end
end) end)
function BennyGame:GetScoreLimit() function BennyGame:GetScoreLimit()
@ -187,15 +192,15 @@ end
function BennyGame:GetPregameTime() function BennyGame:GetPregameTime()
return cPregame:GetInt() return c_g_pregame:GetInt()
end end
function BennyGame:GetPostgameTime() function BennyGame:GetPostgameTime()
return cPostgame:GetInt() return c_g_postgame:GetInt()
end end
function BennyGame:GetIntermissionTime() function BennyGame:GetIntermissionTime()
return cIntermission:GetInt() return c_g_intermission:GetInt()
end end
function BennyGame:GetScoreForTeam( teamid ) function BennyGame:GetScoreForTeam( teamid )
@ -270,7 +275,7 @@ function BennyGame:EndRound( reason, forceteam )
else else
TheFull = TheFull .. l8(TEAMS[winningteam].name) .. " wins! " TheFull = TheFull .. l8(TEAMS[winningteam].name) .. " wins! "
end end
TheFull = TheFull .. cPostgame:GetInt() .. "s until the next round." TheFull = TheFull .. c_g_postgame:GetInt() .. "s until the next round."
PrintMessage(HUD_PRINTCENTER, TheFull) PrintMessage(HUD_PRINTCENTER, TheFull)
local roundtime = CurTime() - BennyGame:GetRoundStartedAt() local roundtime = CurTime() - BennyGame:GetRoundStartedAt()
@ -347,11 +352,11 @@ hook.Add("Think", "Benny_Gamestate_Think", function()
count = count + 1 count = count + 1
end end
if count >= cMinplayers:GetInt() then if count >= c_g_minplayers:GetInt() then
roundstate = BG_STATE_PRE roundstate = BG_STATE_PRE
BennyGame:SetState( roundstate ) BennyGame:SetState( roundstate )
BennyGame:SetPregameStartedAt( CurTime() ) BennyGame:SetPregameStartedAt( CurTime() )
PrintMessage(HUD_PRINTCENTER, "Pregame. " .. cPregame:GetInt() .. "s until the round starts") PrintMessage(HUD_PRINTCENTER, "Pregame. " .. c_g_pregame:GetInt() .. "s until the round starts")
end end
end end
@ -386,3 +391,8 @@ hook.Add("Think", "Benny_Gamestate_Think", function()
end end
end end
end) end)
-- Map functions
function BennyGame:GetMapName()
return "SixT"
end

View File

@ -283,7 +283,11 @@ function GM:HUDPaint()
if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then
CURRCHAR = "benny" CURRCHAR = "benny"
else else
CURRCHAR = TEAMS[myteam].factionid if TEAMS[myteam] then
CURRCHAR = TEAMS[myteam].factionid
else
CURRCHAR = "unassigned"
end
end end
local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN
local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK
@ -808,8 +812,15 @@ local things = {
local function QuickDrawStat( wide, data, first ) local function QuickDrawStat( wide, data, first )
local gap = 0 local gap = 0
local teamd = TEAMS[data.id] local teamd
local faction = FACTIONS[teamd.factionid] local faction
if TEAMS[data.id] then
teamd = TEAMS[data.id]
faction = FACTIONS[teamd.factionid]
else
teamd = TEAMS[0]
faction = FACTIONS[teamd.factionid]
end
local TeamName = l8( teamd.name ) local TeamName = l8( teamd.name )
hTextQ( TeamName, "HUD_36", 0, 0, faction.COLOR_MAIN, nil, nil, faction.COLOR_DARK ) hTextQ( TeamName, "HUD_36", 0, 0, faction.COLOR_MAIN, nil, nil, faction.COLOR_DARK )
@ -881,7 +892,11 @@ function GM:HUDDrawScoreBoard()
if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then
CURRCHAR = "benny" CURRCHAR = "benny"
else else
CURRCHAR = TEAMS[myteam].factionid if TEAMS[myteam] then
CURRCHAR = TEAMS[myteam].factionid
else
CURRCHAR = "unassigned"
end
end end
local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN
local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK

View File

@ -57,7 +57,7 @@ InventoryMeta.__index = InventoryMeta
function PT:GetInventory() function PT:GetInventory()
if !self.Inventory then if !self.Inventory then
print("Creating new inventory for", self) print("[inventory] new inventory created: ", self)
self.Inventory = {} self.Inventory = {}
self.Inventory[0] = { Owner = self } self.Inventory[0] = { Owner = self }
setmetatable( self.Inventory, InventoryMeta ) setmetatable( self.Inventory, InventoryMeta )
@ -65,7 +65,7 @@ function PT:GetInventory()
if SERVER then if SERVER then
for i, v in pairs( self:GetChildren() ) do for i, v in pairs( self:GetChildren() ) do
if v.AEItem then if v.AEItem then
print( "Regen, adding", v, "to inventory") print( "[inventory] regen: adding", v)
self.Inventory[v] = true self.Inventory[v] = true
end end
end end
@ -78,15 +78,15 @@ function PT:GetInventory()
return self.Inventory return self.Inventory
end end
gameevent.Listen( "OnRequestFullUpdate" ) gameevent.Listen( "OnRequestFullUpdate" )
hook.Add( "OnRequestFullUpdate", "OnRequestFullUpdate_example", function( data ) hook.Add( "OnRequestFullUpdate", "Benny_OnRequestFullUpdate_Inventory", function( data )
local name = data.name // Same as Player:Nick() local name = data.name // Same as Player:Nick()
local steamid = data.networkid // Same as Player:SteamID() local steamid = data.networkid // Same as Player:SteamID()
local id = data.userid // Same as Player:UserID() local id = data.userid // Same as Player:UserID()
local index = data.index // Same as Entity:EntIndex() minus one local index = data.index // Same as Entity:EntIndex() minus one
if SERVER then if SERVER then
print("[inventory]", Player(id), "FullUpdate resync")
Player(id):GetInventory():Sync() Player(id):GetInventory():Sync()
end end
end ) end )
@ -95,7 +95,7 @@ if SERVER then
util.AddNetworkString("AEINV_InvSync") util.AddNetworkString("AEINV_InvSync")
else else
net.Receive("AEINV_InvSync", function() net.Receive("AEINV_InvSync", function()
print("Destroyed old inventory") print("[inventory] sync start:")
local p = LocalPlayer() local p = LocalPlayer()
p.Inventory = nil p.Inventory = nil
if p.GetInventory then if p.GetInventory then
@ -103,12 +103,13 @@ else
local count = net.ReadUInt(8) local count = net.ReadUInt(8)
for i=1, count do for i=1, count do
local key = net.ReadEntity() local key = net.ReadEntity()
print( "Added", key) print( "\tadded", key)
inv[key] = true inv[key] = true
end end
else else
print("Asked for inventory too early!!") print("\ti don't have an inventory, maybe you asked too early!!")
end end
print("\tsync done")
end) end)
end end

View File

@ -222,13 +222,17 @@ AddItem( "base_firearm", {
BaseClass.Think( class, ent, handler ) BaseClass.Think( class, ent, handler )
end, end,
["EntThink"] = function( class, ent, handler ) ["EntThink"] = function( class, ent )
if IsValid(handler) then return end if IsValid(ent:GetOwner()) then return end -- Only run this stuff when there's no owner in hand
if CLIENT then return end
local Firedown = ((ent.ShootTime or 0) >= CurTime())
if Firedown then class:Attack( ent ) end
local InProcess = ent:GetBurstCount() > 0 local InProcess = ent:GetBurstCount() > 0
local Topped = ent:GetBurstCount() == class.BurstCount local Topped = ent:GetBurstCount() == class.BurstCount
local Runaway = class.BurstRunaway local Runaway = class.BurstRunaway
local BAuto = class.BurstAuto local BAuto = class.BurstAuto
local Firedown = false
if Runaway and InProcess and !Topped then if Runaway and InProcess and !Topped then
class:Attack( ent, handler ) class:Attack( ent, handler )
else else
@ -243,10 +247,6 @@ AddItem( "base_firearm", {
ent:SetDelayBurst( CurTime() + class.BurstDelay ) ent:SetDelayBurst( CurTime() + class.BurstDelay )
end end
end end
if ent:GetRefillTime() != 0 and ent:GetRefillTime() <= CurTime() then
ent:SetClip( class.ClipSize )
ent:SetRefillTime( 0 )
end
end, end,
["Attack"] = function( class, ent, handler ) ["Attack"] = function( class, ent, handler )
@ -266,6 +266,7 @@ AddItem( "base_firearm", {
ent:SetDelayBurst( CurTime() + class.BurstDelay ) ent:SetDelayBurst( CurTime() + class.BurstDelay )
if BAuto then if BAuto then
ent:SetBurstCount( 0 ) ent:SetBurstCount( 0 )
ent.ShootTime = 0
end end
end end
@ -377,7 +378,7 @@ AddItem( "base_firearm", {
["EntPhysicsCollide"] = function( class, ent, data, collider ) ["EntPhysicsCollide"] = function( class, ent, data, collider )
if ( data.DeltaTime > 0.1 and data.Speed > 200 ) then if ( data.DeltaTime > 0.1 and data.Speed > 200 ) then
class:Attack( ent ) ent.ShootTime = CurTime() + math.Rand( 0.1, 0.5 )
end end
end, end,
@ -632,8 +633,8 @@ do -- Handguns
}) })
AddItem( "cz75", { AddItem( "cz75", {
PrintName = "CZ-75", PrintName = "#Item.cz75.Name",
Description = "9mm handgun", Description = "#Item.cz75.Description",
Category = "pistol", Category = "pistol",
Base = "base_firearm", Base = "base_firearm",
@ -660,8 +661,8 @@ do -- Handguns
}) })
AddItem( "g18", { AddItem( "g18", {
PrintName = "G18", PrintName = "#Item.g18.Name",
Description = "automatic 9mm handgun", Description = "#Item.g18.Description",
Category = "pistol", Category = "pistol",
Base = "base_firearm", Base = "base_firearm",
@ -980,7 +981,7 @@ do -- Shotguns
ClipSize = 8, ClipSize = 8,
Pellets = 8, Pellets = 8,
Delay = 0.4, Delay = 0.22,
BurstCount = 1, BurstCount = 1,
FireSound = { FireSound = {
"benny/weapons/spas12/01.ogg", "benny/weapons/spas12/01.ogg",

View File

@ -6,7 +6,8 @@
Languages = {} Languages = {}
function l8( inp ) function l8( inp )
return Languages["en-us"][inp] or Languages["en-us"][inp] or inp if inp[1] == "#" then inp = inp:Right(-2) else return "Untranslatable: '" .. inp .. "'" end
return Languages["en-us"][inp] or Languages["en-us"][inp] or ("No translation: '" .. inp .. "'")
end end
local AD, IN = AddCSLuaFile, include local AD, IN = AddCSLuaFile, include

View File

@ -3,85 +3,222 @@ local L = {}
Languages["en-us"] = L Languages["en-us"] = L
L["Name"] = "English (United States)" L["Name"] = "English (United States)"
-- Convars
L["Convar.cam_f.Name"] = "Camera Forward Offset"
L["Convar.cam_f.Description"] = ""
L["Convar.cam_fov.Name"] = "Camera FOV"
L["Convar.cam_fov.Description"] = "Field-of-view of the camera, horizontally, in 4:3 (further in higher aspect-ratios)"
L["Convar.cam_fp.Name"] = "First-person Mode"
L["Convar.cam_fp.Description"] = "First-person perspective"
L["Convar.cam_fp_fov.Name"] = "First-person weapon FOV"
L["Convar.cam_fp_fov.Description"] = "How close objects in the player's hand will appear"
L["Convar.cam_r.Name"] = "Camera Right Offset"
L["Convar.cam_r.Description"] = ""
L["Convar.cam_u.Name"] = "Camera Up Offset"
L["Convar.cam_u.Description"] = ""
L["Convar.cheat_endround.Name"] = "Cheat: End Round"
L["Convar.cheat_endround.Description"] = "Cheat"
L["Convar.cheat_rewardxp.Name"] = "Cheat: Reward XP"
L["Convar.cheat_rewardxp.Description"] = "Cheat"
L["Convar.cheat_setxp.Name"] = "Cheat: Set XP"
L["Convar.cheat_setxp.Description"] = "Cheat"
L["Convar.cheat_scoreadd.Name"] = "Cheat: Add Score"
L["Convar.cheat_scoreadd.Description"] = "Cheat"
L["Convar.cheat_scoreset.Name"] = "Cheat: Set Score"
L["Convar.cheat_scoreset.Description"] = "Cheat"
L["Convar.cheat_setstate.Name"] = "Cheat: Set Game State"
L["Convar.cheat_setstate.Description"] = "Cheat"
L["Convar.cheat_setteam.Name"] = "Cheat: Set Team"
L["Convar.cheat_setteam.Description"] = "Cheat"
L["Convar.debug_listbones.Name"] = "debug_listbones"
L["Convar.debug_listbones.Description"] = "List all bones of the current character"
L["Convar.g_intermission.Name"] = "g_intermission"
L["Convar.g_intermission.Description"] = "Intermission time"
L["Convar.g_minplayers.Name"] = "g_minplayers"
L["Convar.g_minplayers.Description"] = "Minimal players necessary to start the game"
L["Convar.g_pregame.Name"] = "g_pregame"
L["Convar.g_pregame.Description"] = "Pre-game time"
L["Convar.g_postgame.Name"] = "g_postgame"
L["Convar.g_postgame.Description"] = "Post-game time"
L["Convar.g_snd_scorelimit.Name"] = "g_snd_scorelimit"
L["Convar.g_snd_scorelimit.Description"] = "Search and Destroy: Score Limit"
L["Convar.g_snd_timelimit.Name"] = "g_snd_timelimit"
L["Convar.g_snd_timelimit.Description"] = "Search and Destroy: Time Limit"
L["Convar.g_tdm_scorelimit.Name"] = "g_tdm_scorelimit"
L["Convar.g_tdm_scorelimit.Description"] = "Team Deathmatch: Score Limit"
L["Convar.g_tdm_timelimit.Name"] = "g_tdm_timelimit"
L["Convar.g_tdm_timelimit.Description"] = "Team Deathmatch: Time Limit"
L["Convar.g_ctf_scorelimit.Name"] = "g_ctf_scorelimit"
L["Convar.g_ctf_scorelimit.Description"] = "Capture the Flag: Score Limit"
L["Convar.g_ctf_timelimit.Name"] = "g_ctf_timelimit"
L["Convar.g_ctf_timelimit.Description"] = "Capture the Flag: Time Limit"
L["Convar.g_dem_scorelimit.Name"] = "g_dem_scorelimit"
L["Convar.g_dem_scorelimit.Description"] = "Demolition: Score Limit"
L["Convar.g_dem_timelimit.Name"] = "g_dem_timelimit"
L["Convar.g_dem_timelimit.Description"] = "Demolition: Time Limit"
L["Convar.g_dom_roundlimit.Name"] = "g_dom_roundlimit"
L["Convar.g_dom_roundlimit.Description"] = "Domination: Round Limit"
L["Convar.g_dom_scorelimit.Name"] = "g_dom_scorelimit"
L["Convar.g_dom_scorelimit.Description"] = "Domination: Score Limit"
L["Convar.g_dom_timelimit.Name"] = "g_dom_timelimit"
L["Convar.g_dom_timelimit.Description"] = "Domination: Time Limit"
L["Convar.g_ffa_scorelimit.Name"] = "g_ffa_scorelimit"
L["Convar.g_ffa_scorelimit.Description"] = "Free For All: Score Limit"
L["Convar.g_ffa_timelimit.Name"] = "g_ffa_timelimit"
L["Convar.g_ffa_timelimit.Description"] = "Free For All: Time Limit"
L["Convar.g_hp_scorelimit.Name"] = "g_hp_scorelimit"
L["Convar.g_hp_scorelimit.Description"] = "Hardpoint: Score Limit"
L["Convar.g_hp_timelimit.Name"] = "g_hp_timelimit"
L["Convar.g_hp_timelimit.Description"] = "Hardpoint: Time Limit"
L["Convar.gamemode.Name"] = "Gamemode"
L["Convar.gamemode.Description"] = "Game mode"
L["Convar.gametype.Name"] = "Gametype"
L["Convar.gametype.Description"] = "Game type: SP or MP"
-- Gamemodes
L["Gamemode.free.Name"] = "Freeplay"
L["Gamemode.free.Description"] = "Objectiveless free-roam."
L["Gamemode.tdm.Name"] = "Team Deathmatch"
L["Gamemode.tdm.Description"] = "Several teams fight to the death for the most kills."
L["Gamemode.ffa.Name"] = "Free-for-all"
L["Gamemode.ffa.Description"] = "Every man for himself."
L["Gamemode.snd.Name"] = "Search and Destroy"
L["Gamemode.snd.Description"] = "One half tries to plant a bomb while the other half attempts to stop it."
L["Gamemode.ctf.Name"] = "Capture the Flag"
L["Gamemode.ctf.Description"] = "Bring your enemies flags to your base."
L["Gamemode.dom.Name"] = "Domination"
L["Gamemode.dom.Description"] = "Several teams fight to hold capture points for the longest amount of time"
L["Gamemode.dem.Name"] = "Demolition"
L["Gamemode.dem.Description"] = "One half tries to destroy the other halves objectives."
L["Gamemode.hp.Name"] = "Hardpoint"
L["Gamemode.hp.Description"] = "Several teams fight to hold a singular capture point for the longest amount of time."
-- Teams -- Teams
L["#Team.cia.Name"] = "CIA" L["Team.cia.Name"] = "CIA"
L["#Team.cia.Description"] = "CIA black ops, coverup crew" L["Team.cia.Description"] = "CIA black ops, coverup crew"
L["#Team.halo.Name"] = "HALO" L["Team.halo.Name"] = "HALO"
L["#Team.halo.Description"] = "Assassination agency?" L["Team.halo.Description"] = "Assassination agency?"
L["#Team.plasof.Name"] = "PLASOF" L["Team.plasof.Name"] = "PLASOF"
L["#Team.plasof.Description"] = "People's Liberation Army Special Operations Forces" L["Team.plasof.Description"] = "People's Liberation Army Special Operations Forces"
L["#Team.arng.Name"] = "NATIONAL GUARD" L["Team.arng.Name"] = "NATIONAL GUARD"
L["#Team.arng.Description"] = "United States National Guard" L["Team.arng.Description"] = "United States National Guard"
L["#Team.militia.Name"] = "MILITIA" L["Team.militia.Name"] = "MILITIA"
L["#Team.militia.Description"] = "Brazilian militia??? what" L["Team.militia.Description"] = "Brazilian militia??? what"
L["#Team.viper.Name"] = "VIPERS" L["Team.viper.Name"] = "VIPERS"
L["#Team.viper.Description"] = "Gang" L["Team.viper.Description"] = "Gang"
-- Items -- Items
L["#Item.mk23.Name"] = "MK.23" L["Item.mk23.Name"] = "MK.23"
L["#Item.mk23.Description"] = "Special forces sidearm" L["Item.mk23.Description"] = "Special forces sidearm"
L["#Item.fnc.Name"] = "FNC Para" L["Item.cz75.Name"] = "CZ-75"
L["#Item.fnc.Description"] = "Imported assault rifle" L["Item.cz75.Description"] = "Rugged semi-automatic handgun"
L["#Item.qbz.Name"] = "QBZ-95" L["Item.g18.Name"] = "G18"
L["#Item.qbz.Description"] = "Low-profile bullpup assault rifle" L["Item.g18.Description"] = "Automatic machine pistol"
L["#Item.qbb.Name"] = "QBB-LSW" L["Item.fnc.Name"] = "FNC Para"
L["#Item.qbb.Description"] = "Bullpup machine gun" L["Item.fnc.Description"] = "Imported assault rifle"
L["#Item.stoner.Name"] = "STONER-63" L["Item.qbz.Name"] = "QBZ-95"
L["#Item.stoner.Description"] = "Modular machine gun" L["Item.qbz.Description"] = "Low-profile bullpup assault rifle"
L["#Item.hk21.Name"] = "HK-21" L["Item.qbb.Name"] = "QBB-LSW"
L["#Item.hk21.Description"] = "Powerful medium machine gun" L["Item.qbb.Description"] = "Bullpup machine gun"
L["#Item.m16a2.Name"] = "M16A2" L["Item.stoner.Name"] = "STONER-63"
L["#Item.m16a2.Description"] = "Rugged burst rifle" L["Item.stoner.Description"] = "Modular machine gun"
L["#Item.oicw.Name"] = "OICW" L["Item.hk21.Name"] = "HK-21"
L["#Item.oicw.Description"] = "Advanced combat rifle" L["Item.hk21.Description"] = "Powerful medium machine gun"
L["#Item.spas12.Name"] = "SPAS-12" L["Item.m16a2.Name"] = "M16A2"
L["#Item.spas12.Description"] = "Chrome-lined autoshotgun" L["Item.m16a2.Description"] = "Rugged burst rifle"
L["#Item.tmp.Name"] = "TMP" L["Item.oicw.Name"] = "OICW"
L["#Item.tmp.Description"] = "Concealable machine pistol" L["Item.oicw.Description"] = "Advanced combat rifle"
L["#Item.mp5k.Name"] = "MP5K" L["Item.spas12.Name"] = "SPAS-12"
L["#Item.mp5k.Description"] = "High-quality SMG" L["Item.spas12.Description"] = "Chrome-lined autoshotgun"
L["#Item.mp7.Name"] = "MP7" L["Item.tmp.Name"] = "TMP"
L["#Item.mp7.Description"] = "Special forces PDW" L["Item.tmp.Description"] = "Concealable machine pistol"
L["#Item.mac11.Name"] = "MAC-11" L["Item.mp5k.Name"] = "MP5K"
L["#Item.mac11.Description"] = "Tiny hornet gun" L["Item.mp5k.Description"] = "High-quality SMG"
L["#Item.1887.Name"] = "1887" L["Item.mp7.Name"] = "MP7"
L["#Item.1887.Description"] = "Lever-action" L["Item.mp7.Description"] = "Special forces PDW"
L["#Item.db.Name"] = "DB" L["Item.mac11.Name"] = "MAC-11"
L["#Item.db.Description"] = "Side-by-side shotgun" L["Item.mac11.Description"] = "Tiny hornet gun"
L["#Item.aa12.Name"] = "AA-12" L["Item.1887.Name"] = "1887"
L["#Item.aa12.Description"] = "Automatic combat shotgun" L["Item.1887.Description"] = "Lever-action"
L["#Item.striker.Name"] = "Streetsweeper" L["Item.db.Name"] = "DB"
L["#Item.striker.Description"] = "Semi-automatic drum-fed shotgun" L["Item.db.Description"] = "Side-by-side shotgun"
L["#Item.r870.Name"] = "R870" L["Item.aa12.Name"] = "AA-12"
L["#Item.r870.Description"] = "Sawn-off pump-action shotgun" L["Item.aa12.Description"] = "Automatic combat shotgun"
L["#Item.spas15.Name"] = "SPAS-15" L["Item.striker.Name"] = "Streetsweeper"
L["#Item.spas15.Description"] = "Mag-fed pump-action shotgun" L["Item.striker.Description"] = "Semi-automatic drum-fed shotgun"
L["#Item.satchels.Name"] = "Satchels" L["Item.r870.Name"] = "R870"
L["#Item.satchels.Description"] = "Packs of bombs and a detonator" L["Item.r870.Description"] = "Sawn-off pump-action shotgun"
L["#Item.toolgun.Name"] = "Tool gun" L["Item.spas15.Name"] = "SPAS-15"
L["#Item.toolgun.Description"] = "Developer tools" L["Item.spas15.Description"] = "Mag-fed pump-action shotgun"
L["Item.satchels.Name"] = "Satchels"
L["Item.satchels.Description"] = "Packs of bombs and a detonator"
L["Item.toolgun.Name"] = "Tool gun"
L["Item.toolgun.Description"] = "Developer tools"

View File

@ -14,12 +14,12 @@ local settings = {
{ {
name = "Camera", name = "Camera",
items = { items = {
{ type = TYPE_NUMBER, cvar = "b-cam_f", min = -200, max = 200, name = "Camera Forward" }, { type = TYPE_NUMBER, cvar = "cam_f", min = -200, max = 200 },
{ type = TYPE_NUMBER, cvar = "b-cam_r", min = -30, max = 30, name = "Camera Right" }, { type = TYPE_NUMBER, cvar = "cam_r", min = -30, max = 30 },
{ type = TYPE_NUMBER, cvar = "b-cam_u", min = -30, max = 30, name = "Camera Up" }, { type = TYPE_NUMBER, cvar = "cam_u", min = -30, max = 30 },
{ type = TYPE_NUMBER, cvar = "b-cam_fov", min = 30, max = 120, name = "Camera FOV" }, { type = TYPE_NUMBER, cvar = "cam_fov", min = 30, max = 120 },
{ type = TYPE_BOOL, cvar = "b-cam_fp", name = "First-person Mode" }, { type = TYPE_BOOL, cvar = "cam_fp" },
{ type = TYPE_NUMBER, cvar = "b-cam_fp_fov", min = 30, max = 120, name = "FP weapon FOV" }, { type = TYPE_NUMBER, cvar = "cam_fp_fov", min = 30, max = 120 },
} }
}, },
{ {
@ -80,17 +80,17 @@ local entries = {
SP:AddItem(Cat) SP:AddItem(Cat)
for index, data in ipairs( data.items ) do for index, data in ipairs( data.items ) do
if !data.cvarpointer then data.cvarpointer = GetConVar(data.cvar) end if !data.cvarpointer then data.cvarpointer = GetConVar("b-" .. data.cvar) end
if data.type == TYPE_BOOL then if data.type == TYPE_BOOL then
local Changer = vgui.Create("DCheckBoxLabel", Cat) local Changer = vgui.Create("DCheckBoxLabel", Cat)
Changer:Dock( TOP ) Changer:Dock( TOP )
Changer:SetConVar( data.cvar ) Changer:SetConVar( "b-" .. data.cvar )
Changer:SetText( data.name ) Changer:SetText( l8( "#Convar." .. data.cvar .. ".Name" ) )
elseif data.type == TYPE_NUMBER then elseif data.type == TYPE_NUMBER then
local Changer = vgui.Create("DNumSlider", Cat) local Changer = vgui.Create("DNumSlider", Cat)
Changer:Dock( TOP ) Changer:Dock( TOP )
Changer:SetConVar( data.cvar ) Changer:SetConVar( "b-" .. data.cvar )
Changer:SetText( data.name ) Changer:SetText( l8( "#Convar." .. data.cvar .. ".Name" ) )
Changer:SetMin( data.min ) Changer:SetMin( data.min )
Changer:SetMax( data.max ) Changer:SetMax( data.max )
Changer:SetDecimals( 0 ) Changer:SetDecimals( 0 )

View File

@ -42,8 +42,13 @@ function TSelShared( tbl, seed )
return tbl[math.Round( util.SharedRandom( seed, 1, #tbl ) )] return tbl[math.Round( util.SharedRandom( seed, 1, #tbl ) )]
end end
-- Language might want to be loaded first
-- Otherwise things will fail to call 'l8'
AC("language.lua") AC("language.lua")
IN("language.lua") IN("language.lua")
AC("convars.lua")
IN("convars.lua")
AC("camera.lua") AC("camera.lua")
IN("camera.lua") IN("camera.lua")
AC("items.lua") AC("items.lua")