Compare commits
2 Commits
79d9b040f3
...
60c7a15272
Author | SHA1 | Date |
---|---|---|
Fesiug | 60c7a15272 | |
Fesiug | 780ec39711 |
|
@ -29,7 +29,7 @@ else
|
|||
|
||||
if ent:IsValid() then
|
||||
ent:SetPredictable( false )
|
||||
print("CL Stopping prediction on", ent)
|
||||
print("[prediction] cl stop:", ent)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
@ -73,7 +73,7 @@ function ENT:Think()
|
|||
net.Start("Benny_ItemSlept")
|
||||
net.WriteEntity(self)
|
||||
net.Broadcast()
|
||||
print("SV Stopping prediction on", self)
|
||||
print("[prediction] sv stop:", self)
|
||||
--self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
|
||||
self.BAsleep = true
|
||||
end
|
||||
|
|
|
@ -109,10 +109,9 @@ else
|
|||
local ent = net.ReadEntity()
|
||||
if ent:IsValid() then
|
||||
ent:SetPredictable( net.ReadBool() )
|
||||
print("Starting prediction on", ent)
|
||||
print("[prediction] cl prediction start:", ent)
|
||||
else
|
||||
print("Tried to make an ent predictable but it wasn't valid.")
|
||||
debug.Trace()
|
||||
print("[prediction] cl tried to predict invalid ent")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
@ -122,14 +121,13 @@ function SWEP:EquipItem( ent )
|
|||
if CLIENT then print("FUCK OFF") debug.Trace() return end
|
||||
if IsValid(ent) and ent.BennyItem 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
|
||||
end
|
||||
if p:GetInventory()[ent] then
|
||||
print( ent, "is in", p, "'s inventory!" )
|
||||
return
|
||||
end
|
||||
print("Pick up", ent)
|
||||
print("[equip]", ent)
|
||||
|
||||
self:SetDesireR( ent )
|
||||
|
||||
|
@ -162,7 +160,7 @@ function SWEP:DropItem()
|
|||
local p = self:GetOwner()
|
||||
local ent = self:GetActiveR()
|
||||
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 )
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
-- Your Name is Benny
|
||||
---------------------
|
||||
|
||||
local cam_f = CreateConVar( "b-cam_f", -75 )
|
||||
local cam_r = CreateConVar( "b-cam_r", 12 )
|
||||
local cam_u = CreateConVar( "b-cam_u", 12 )
|
||||
local cam_fov = CreateConVar( "b-cam_fov", 75 )
|
||||
BENNY.AddConvar( "cam_f", -75 )
|
||||
BENNY.AddConvar( "cam_r", 12 )
|
||||
BENNY.AddConvar( "cam_u", 12 )
|
||||
BENNY.AddConvar( "cam_fov", 75 )
|
||||
|
||||
local cam_fp = CreateConVar( "b-cam_fp", 0 )
|
||||
local cam_fp_fov = CreateConVar( "b-cam_fp_fov", 75 )
|
||||
BENNY.AddConvar( "cam_fp", 0 )
|
||||
BENNY.AddConvar( "cam_fp_fov", 75 )
|
||||
local lastfp
|
||||
|
||||
local m = 3
|
||||
|
@ -24,13 +24,13 @@ function CamSpot( ang, pos )
|
|||
local f, r, u = TPSOverride:Forward(), TPSOverride:Right(), TPSOverride:Up()
|
||||
local tr = {
|
||||
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,
|
||||
mins = m1,
|
||||
maxs = m2,
|
||||
}
|
||||
if cam_fp:GetBool() then
|
||||
tr.endpos = EyePos()
|
||||
if c_cam_fp:GetBool() then
|
||||
tr.endpos = LocalPlayer():EyePos()
|
||||
end
|
||||
tr = util.TraceHull(tr)
|
||||
return tr.HitPos
|
||||
|
@ -49,9 +49,9 @@ function QConvert( fovDegrees )
|
|||
end
|
||||
|
||||
function GM:PreDrawViewModels()
|
||||
local fp = cam_fp:GetBool()
|
||||
local fp = c_cam_fp:GetBool()
|
||||
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 )
|
||||
local p = LocalPlayer()
|
||||
p.IWantDraw = true
|
||||
|
@ -67,7 +67,7 @@ function GM:PreDrawViewModels()
|
|||
end
|
||||
|
||||
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
|
||||
return true
|
||||
end
|
||||
|
@ -77,15 +77,16 @@ function GM:CalcView( ply, pos, ang, fov )
|
|||
local view = {
|
||||
origin = CamSpot(TPSOverride), -- pos includes the smoothstair offset which looks stupid here
|
||||
angles = TPSOverride,
|
||||
fov = cam_fov:GetFloat(),
|
||||
fov = c_cam_fov:GetFloat(),
|
||||
drawviewer = true
|
||||
}
|
||||
|
||||
local fp = cam_fp:GetBool()
|
||||
local fp = c_cam_fp:GetBool()
|
||||
if fp then
|
||||
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:Add( vector_up*10 )
|
||||
|
||||
if ply:GetLayerSequence( GESTURE_SLOT_JUMP ) == ply:LookupSequence("dive_end_handgun") then
|
||||
local progress = ply:GetLayerCycle( GESTURE_SLOT_JUMP )
|
||||
|
@ -145,7 +146,7 @@ hook.Add( "OnRequestFullUpdate", "Benny_OnRequestFullUpdate_CameraFP", function(
|
|||
if CLIENT then
|
||||
local ply = LocalPlayer()
|
||||
if !ply:IsValid() then return end
|
||||
local fp = cam_fp:GetBool()
|
||||
local fp = c_cam_fp:GetBool()
|
||||
if lastfp == nil then lastfp = !fp end
|
||||
timer.Simple( 0, function()
|
||||
if !fp then
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
-- Your Name is Benny
|
||||
---------------------
|
||||
|
||||
Convars = {}
|
||||
|
||||
Convars.List = {}
|
||||
|
||||
function Convars:Add( name, def, help, mins, max )
|
||||
|
||||
function BENNY.AddConvar( name, value, flags, mins, maxs )
|
||||
local CV = CreateConVar( "b-" .. name, value, flags, l8( "#Convar." .. name .. ".Description" ), mins, maxs )
|
||||
_G["c_" .. name] = CV
|
||||
-- print( "Created Convar: " .. name .. " : " .. l8( "#Convar." .. name .. ".Name" ) .. " : " .. l8( "#Convar." .. name .. ".Description" ) )
|
||||
return CV
|
||||
end
|
||||
|
||||
function Convars:GetVector()
|
||||
local exploded = string.Explode( " ", "" )
|
||||
return Vector()
|
||||
function BENNY.AddClientConvar( name, value, flags, mins, maxs )
|
||||
if SERVER then return end
|
||||
return BENNY.AddConvar( name, value, flags, mins, maxs )
|
||||
end
|
|
@ -5,20 +5,20 @@ BennyGame = BennyGame or {}
|
|||
BG_GTYPE_CAMPAIGN = 0
|
||||
BG_GTYPE_MP = 1
|
||||
|
||||
local cGametype = CreateConVar("b-gametype", 1, nil, "0 for Campaign, 1 for MP")
|
||||
local cGamemode = CreateConVar("b-gamemode", "dom", nil, "")
|
||||
BENNY.AddConvar("gametype", 1)
|
||||
BENNY.AddConvar("gamemode", "dom")
|
||||
|
||||
local cMinplayers = CreateConVar("b-g_minplayers", 2)
|
||||
local cPregame = CreateConVar("b-g_pregame", 15)
|
||||
local cPostgame = CreateConVar("b-g_postgame", 15)
|
||||
local cIntermission = CreateConVar("b-g_intermission", 10)
|
||||
BENNY.AddConvar("g_minplayers", 2)
|
||||
BENNY.AddConvar("g_pregame", 15)
|
||||
BENNY.AddConvar("g_postgame", 15)
|
||||
BENNY.AddConvar("g_intermission", 10)
|
||||
|
||||
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
|
||||
|
||||
function BennyGame:GetMode()
|
||||
return cGamemode:GetString()
|
||||
return c_gamemode:GetString()
|
||||
end
|
||||
|
||||
function BennyGame:GetModeData()
|
||||
|
@ -45,52 +45,52 @@ BennyGame.Gamemodes = {
|
|||
name = "#Gamemode.tdm.Name",
|
||||
description = "#Gamemode.tdm.Description",
|
||||
|
||||
scorelimit = CreateConVar("b-g_tdm_scorelimit", 75 ),
|
||||
timelimit = CreateConVar("b-g_tdm_timelimit", 10*60 ),
|
||||
scorelimit = BENNY.AddConvar("g_tdm_scorelimit", 75 ),
|
||||
timelimit = BENNY.AddConvar("g_tdm_timelimit", 10*60 ),
|
||||
},
|
||||
["ffa"] = {
|
||||
name = "#Gamemode.ffa.Name",
|
||||
description = "#Gamemode.ffa.Description",
|
||||
|
||||
scorelimit = CreateConVar("b-g_ffa_scorelimit", 30 ),
|
||||
timelimit = CreateConVar("b-g_ffa_timelimit", 10*60 ),
|
||||
scorelimit = BENNY.AddConvar("g_ffa_scorelimit", 30 ),
|
||||
timelimit = BENNY.AddConvar("g_ffa_timelimit", 10*60 ),
|
||||
},
|
||||
["snd"] = {
|
||||
name = "#Gamemode.snd.Name",
|
||||
description = "#Gamemode.snd.Description",
|
||||
|
||||
scorelimit = CreateConVar("b-g_snd_scorelimit", 6 ),
|
||||
timelimit = CreateConVar("b-g_snd_timelimit", 2.5*60 ),
|
||||
scorelimit = BENNY.AddConvar("g_snd_scorelimit", 6 ),
|
||||
timelimit = BENNY.AddConvar("g_snd_timelimit", 2.5*60 ),
|
||||
},
|
||||
["ctf"] = {
|
||||
name = "#Gamemode.ctf.Name",
|
||||
description = "#Gamemode.ctf.Description",
|
||||
|
||||
scorelimit = CreateConVar("b-g_ctf_scorelimit", 3 ),
|
||||
timelimit = CreateConVar("b-g_ctf_timelimit", 10*60 ),
|
||||
scorelimit = BENNY.AddConvar("g_ctf_scorelimit", 3 ),
|
||||
timelimit = BENNY.AddConvar("g_ctf_timelimit", 10*60 ),
|
||||
},
|
||||
["dom"] = {
|
||||
name = "#Gamemode.dom.Name",
|
||||
description = "#Gamemode.dom.Description",
|
||||
|
||||
scorelimit = CreateConVar("b-g_dom_scorelimit", 1000 ),
|
||||
timelimit = CreateConVar("b-g_dom_timelimit", 10*60 ),
|
||||
roundlimit = CreateConVar("b-g_dom_roundlimit", 1 ),
|
||||
scorelimit = BENNY.AddConvar("g_dom_scorelimit", 1000 ),
|
||||
timelimit = BENNY.AddConvar("g_dom_timelimit", 10*60 ),
|
||||
roundlimit = BENNY.AddConvar("g_dom_roundlimit", 1 ),
|
||||
},
|
||||
["dem"] = {
|
||||
name = "#Gamemode.dem.Name",
|
||||
description = "#Gamemode.dem.Description",
|
||||
|
||||
scorelimit = CreateConVar("b-g_dem_scorelimit", 3 ),
|
||||
timelimit = CreateConVar("b-g_dem_timelimit", 5*60 ),
|
||||
roundlimit = CreateConVar("b-g_dom_roundlimit", 2 ),
|
||||
scorelimit = BENNY.AddConvar("g_dem_scorelimit", 3 ),
|
||||
timelimit = BENNY.AddConvar("g_dem_timelimit", 5*60 ),
|
||||
roundlimit = BENNY.AddConvar("g_dom_roundlimit", 2 ),
|
||||
},
|
||||
["hp"] = {
|
||||
name = "#Gamemode.hp.Name",
|
||||
description = "#Gamemode.hp.Description",
|
||||
|
||||
scorelimit = CreateConVar("b-g_hp_scorelimit", 300 ),
|
||||
timelimit = CreateConVar("b-g_hp_timelimit", 10*60 ),
|
||||
scorelimit = BENNY.AddConvar("g_hp_scorelimit", 300 ),
|
||||
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( "SwappedAtRound", "Int", 1 )
|
||||
BennyGame:Accessor( "TimeExtension", "Int", 0 )
|
||||
BennyGame:Accessor( "UUID", "Int", 0 )
|
||||
|
||||
BennyGame:Accessor( "Team1_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( "TeamsSwapped", "Bool", false )
|
||||
|
||||
if SERVER then
|
||||
BennyGame:SetUUID( math.random( -(2^31), (2^31)-1 ) )
|
||||
end
|
||||
end)
|
||||
|
||||
function BennyGame:GetScoreLimit()
|
||||
|
@ -187,15 +192,15 @@ end
|
|||
|
||||
|
||||
function BennyGame:GetPregameTime()
|
||||
return cPregame:GetInt()
|
||||
return c_g_pregame:GetInt()
|
||||
end
|
||||
|
||||
function BennyGame:GetPostgameTime()
|
||||
return cPostgame:GetInt()
|
||||
return c_g_postgame:GetInt()
|
||||
end
|
||||
|
||||
function BennyGame:GetIntermissionTime()
|
||||
return cIntermission:GetInt()
|
||||
return c_g_intermission:GetInt()
|
||||
end
|
||||
|
||||
function BennyGame:GetScoreForTeam( teamid )
|
||||
|
@ -270,7 +275,7 @@ function BennyGame:EndRound( reason, forceteam )
|
|||
else
|
||||
TheFull = TheFull .. l8(TEAMS[winningteam].name) .. " wins! "
|
||||
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)
|
||||
|
||||
local roundtime = CurTime() - BennyGame:GetRoundStartedAt()
|
||||
|
@ -347,11 +352,11 @@ hook.Add("Think", "Benny_Gamestate_Think", function()
|
|||
|
||||
count = count + 1
|
||||
end
|
||||
if count >= cMinplayers:GetInt() then
|
||||
if count >= c_g_minplayers:GetInt() then
|
||||
roundstate = BG_STATE_PRE
|
||||
BennyGame:SetState( roundstate )
|
||||
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
|
||||
|
||||
|
@ -385,4 +390,9 @@ hook.Add("Think", "Benny_Gamestate_Think", function()
|
|||
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
-- Map functions
|
||||
function BennyGame:GetMapName()
|
||||
return "SixT"
|
||||
end
|
|
@ -283,7 +283,11 @@ function GM:HUDPaint()
|
|||
if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then
|
||||
CURRCHAR = "benny"
|
||||
else
|
||||
CURRCHAR = TEAMS[myteam].factionid
|
||||
if TEAMS[myteam] then
|
||||
CURRCHAR = TEAMS[myteam].factionid
|
||||
else
|
||||
CURRCHAR = "unassigned"
|
||||
end
|
||||
end
|
||||
local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN
|
||||
local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK
|
||||
|
@ -808,8 +812,15 @@ local things = {
|
|||
|
||||
local function QuickDrawStat( wide, data, first )
|
||||
local gap = 0
|
||||
local teamd = TEAMS[data.id]
|
||||
local faction = FACTIONS[teamd.factionid]
|
||||
local teamd
|
||||
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 )
|
||||
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
|
||||
CURRCHAR = "benny"
|
||||
else
|
||||
CURRCHAR = TEAMS[myteam].factionid
|
||||
if TEAMS[myteam] then
|
||||
CURRCHAR = TEAMS[myteam].factionid
|
||||
else
|
||||
CURRCHAR = "unassigned"
|
||||
end
|
||||
end
|
||||
local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN
|
||||
local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK
|
||||
|
|
|
@ -57,7 +57,7 @@ InventoryMeta.__index = InventoryMeta
|
|||
|
||||
function PT:GetInventory()
|
||||
if !self.Inventory then
|
||||
print("Creating new inventory for", self)
|
||||
print("[inventory] new inventory created: ", self)
|
||||
self.Inventory = {}
|
||||
self.Inventory[0] = { Owner = self }
|
||||
setmetatable( self.Inventory, InventoryMeta )
|
||||
|
@ -65,7 +65,7 @@ function PT:GetInventory()
|
|||
if SERVER then
|
||||
for i, v in pairs( self:GetChildren() ) do
|
||||
if v.AEItem then
|
||||
print( "Regen, adding", v, "to inventory")
|
||||
print( "[inventory] regen: adding", v)
|
||||
self.Inventory[v] = true
|
||||
end
|
||||
end
|
||||
|
@ -78,15 +78,15 @@ function PT:GetInventory()
|
|||
return self.Inventory
|
||||
end
|
||||
|
||||
|
||||
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 steamid = data.networkid // Same as Player:SteamID()
|
||||
local id = data.userid // Same as Player:UserID()
|
||||
local index = data.index // Same as Entity:EntIndex() minus one
|
||||
|
||||
if SERVER then
|
||||
print("[inventory]", Player(id), "FullUpdate resync")
|
||||
Player(id):GetInventory():Sync()
|
||||
end
|
||||
end )
|
||||
|
@ -95,7 +95,7 @@ if SERVER then
|
|||
util.AddNetworkString("AEINV_InvSync")
|
||||
else
|
||||
net.Receive("AEINV_InvSync", function()
|
||||
print("Destroyed old inventory")
|
||||
print("[inventory] sync start:")
|
||||
local p = LocalPlayer()
|
||||
p.Inventory = nil
|
||||
if p.GetInventory then
|
||||
|
@ -103,12 +103,13 @@ else
|
|||
local count = net.ReadUInt(8)
|
||||
for i=1, count do
|
||||
local key = net.ReadEntity()
|
||||
print( "Added", key)
|
||||
print( "\tadded", key)
|
||||
inv[key] = true
|
||||
end
|
||||
else
|
||||
print("Asked for inventory too early!!")
|
||||
print("\ti don't have an inventory, maybe you asked too early!!")
|
||||
end
|
||||
print("\tsync done")
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
@ -222,13 +222,17 @@ AddItem( "base_firearm", {
|
|||
BaseClass.Think( class, ent, handler )
|
||||
end,
|
||||
|
||||
["EntThink"] = function( class, ent, handler )
|
||||
if IsValid(handler) then return end
|
||||
["EntThink"] = function( class, ent )
|
||||
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 Topped = ent:GetBurstCount() == class.BurstCount
|
||||
local Runaway = class.BurstRunaway
|
||||
local BAuto = class.BurstAuto
|
||||
local Firedown = false
|
||||
if Runaway and InProcess and !Topped then
|
||||
class:Attack( ent, handler )
|
||||
else
|
||||
|
@ -243,10 +247,6 @@ AddItem( "base_firearm", {
|
|||
ent:SetDelayBurst( CurTime() + class.BurstDelay )
|
||||
end
|
||||
end
|
||||
if ent:GetRefillTime() != 0 and ent:GetRefillTime() <= CurTime() then
|
||||
ent:SetClip( class.ClipSize )
|
||||
ent:SetRefillTime( 0 )
|
||||
end
|
||||
end,
|
||||
|
||||
["Attack"] = function( class, ent, handler )
|
||||
|
@ -266,6 +266,7 @@ AddItem( "base_firearm", {
|
|||
ent:SetDelayBurst( CurTime() + class.BurstDelay )
|
||||
if BAuto then
|
||||
ent:SetBurstCount( 0 )
|
||||
ent.ShootTime = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -377,7 +378,7 @@ AddItem( "base_firearm", {
|
|||
|
||||
["EntPhysicsCollide"] = function( class, ent, data, collider )
|
||||
if ( data.DeltaTime > 0.1 and data.Speed > 200 ) then
|
||||
class:Attack( ent )
|
||||
ent.ShootTime = CurTime() + math.Rand( 0.1, 0.5 )
|
||||
end
|
||||
end,
|
||||
|
||||
|
@ -632,8 +633,8 @@ do -- Handguns
|
|||
})
|
||||
|
||||
AddItem( "cz75", {
|
||||
PrintName = "CZ-75",
|
||||
Description = "9mm handgun",
|
||||
PrintName = "#Item.cz75.Name",
|
||||
Description = "#Item.cz75.Description",
|
||||
Category = "pistol",
|
||||
Base = "base_firearm",
|
||||
|
||||
|
@ -660,8 +661,8 @@ do -- Handguns
|
|||
})
|
||||
|
||||
AddItem( "g18", {
|
||||
PrintName = "G18",
|
||||
Description = "automatic 9mm handgun",
|
||||
PrintName = "#Item.g18.Name",
|
||||
Description = "#Item.g18.Description",
|
||||
Category = "pistol",
|
||||
Base = "base_firearm",
|
||||
|
||||
|
@ -980,7 +981,7 @@ do -- Shotguns
|
|||
|
||||
ClipSize = 8,
|
||||
Pellets = 8,
|
||||
Delay = 0.4,
|
||||
Delay = 0.22,
|
||||
BurstCount = 1,
|
||||
FireSound = {
|
||||
"benny/weapons/spas12/01.ogg",
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
Languages = {}
|
||||
|
||||
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
|
||||
|
||||
local AD, IN = AddCSLuaFile, include
|
||||
|
|
|
@ -3,85 +3,222 @@ local L = {}
|
|||
Languages["en-us"] = L
|
||||
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
|
||||
L["#Team.cia.Name"] = "CIA"
|
||||
L["#Team.cia.Description"] = "CIA black ops, coverup crew"
|
||||
L["Team.cia.Name"] = "CIA"
|
||||
L["Team.cia.Description"] = "CIA black ops, coverup crew"
|
||||
|
||||
L["#Team.halo.Name"] = "HALO"
|
||||
L["#Team.halo.Description"] = "Assassination agency?"
|
||||
L["Team.halo.Name"] = "HALO"
|
||||
L["Team.halo.Description"] = "Assassination agency?"
|
||||
|
||||
L["#Team.plasof.Name"] = "PLASOF"
|
||||
L["#Team.plasof.Description"] = "People's Liberation Army Special Operations Forces"
|
||||
L["Team.plasof.Name"] = "PLASOF"
|
||||
L["Team.plasof.Description"] = "People's Liberation Army Special Operations Forces"
|
||||
|
||||
L["#Team.arng.Name"] = "NATIONAL GUARD"
|
||||
L["#Team.arng.Description"] = "United States National Guard"
|
||||
L["Team.arng.Name"] = "NATIONAL GUARD"
|
||||
L["Team.arng.Description"] = "United States National Guard"
|
||||
|
||||
L["#Team.militia.Name"] = "MILITIA"
|
||||
L["#Team.militia.Description"] = "Brazilian militia??? what"
|
||||
L["Team.militia.Name"] = "MILITIA"
|
||||
L["Team.militia.Description"] = "Brazilian militia??? what"
|
||||
|
||||
L["#Team.viper.Name"] = "VIPERS"
|
||||
L["#Team.viper.Description"] = "Gang"
|
||||
L["Team.viper.Name"] = "VIPERS"
|
||||
L["Team.viper.Description"] = "Gang"
|
||||
|
||||
-- Items
|
||||
L["#Item.mk23.Name"] = "MK.23"
|
||||
L["#Item.mk23.Description"] = "Special forces sidearm"
|
||||
L["Item.mk23.Name"] = "MK.23"
|
||||
L["Item.mk23.Description"] = "Special forces sidearm"
|
||||
|
||||
L["#Item.fnc.Name"] = "FNC Para"
|
||||
L["#Item.fnc.Description"] = "Imported assault rifle"
|
||||
L["Item.cz75.Name"] = "CZ-75"
|
||||
L["Item.cz75.Description"] = "Rugged semi-automatic handgun"
|
||||
|
||||
L["#Item.qbz.Name"] = "QBZ-95"
|
||||
L["#Item.qbz.Description"] = "Low-profile bullpup assault rifle"
|
||||
L["Item.g18.Name"] = "G18"
|
||||
L["Item.g18.Description"] = "Automatic machine pistol"
|
||||
|
||||
L["#Item.qbb.Name"] = "QBB-LSW"
|
||||
L["#Item.qbb.Description"] = "Bullpup machine gun"
|
||||
L["Item.fnc.Name"] = "FNC Para"
|
||||
L["Item.fnc.Description"] = "Imported assault rifle"
|
||||
|
||||
L["#Item.stoner.Name"] = "STONER-63"
|
||||
L["#Item.stoner.Description"] = "Modular machine gun"
|
||||
L["Item.qbz.Name"] = "QBZ-95"
|
||||
L["Item.qbz.Description"] = "Low-profile bullpup assault rifle"
|
||||
|
||||
L["#Item.hk21.Name"] = "HK-21"
|
||||
L["#Item.hk21.Description"] = "Powerful medium machine gun"
|
||||
L["Item.qbb.Name"] = "QBB-LSW"
|
||||
L["Item.qbb.Description"] = "Bullpup machine gun"
|
||||
|
||||
L["#Item.m16a2.Name"] = "M16A2"
|
||||
L["#Item.m16a2.Description"] = "Rugged burst rifle"
|
||||
L["Item.stoner.Name"] = "STONER-63"
|
||||
L["Item.stoner.Description"] = "Modular machine gun"
|
||||
|
||||
L["#Item.oicw.Name"] = "OICW"
|
||||
L["#Item.oicw.Description"] = "Advanced combat rifle"
|
||||
L["Item.hk21.Name"] = "HK-21"
|
||||
L["Item.hk21.Description"] = "Powerful medium machine gun"
|
||||
|
||||
L["#Item.spas12.Name"] = "SPAS-12"
|
||||
L["#Item.spas12.Description"] = "Chrome-lined autoshotgun"
|
||||
L["Item.m16a2.Name"] = "M16A2"
|
||||
L["Item.m16a2.Description"] = "Rugged burst rifle"
|
||||
|
||||
L["#Item.tmp.Name"] = "TMP"
|
||||
L["#Item.tmp.Description"] = "Concealable machine pistol"
|
||||
L["Item.oicw.Name"] = "OICW"
|
||||
L["Item.oicw.Description"] = "Advanced combat rifle"
|
||||
|
||||
L["#Item.mp5k.Name"] = "MP5K"
|
||||
L["#Item.mp5k.Description"] = "High-quality SMG"
|
||||
L["Item.spas12.Name"] = "SPAS-12"
|
||||
L["Item.spas12.Description"] = "Chrome-lined autoshotgun"
|
||||
|
||||
L["#Item.mp7.Name"] = "MP7"
|
||||
L["#Item.mp7.Description"] = "Special forces PDW"
|
||||
L["Item.tmp.Name"] = "TMP"
|
||||
L["Item.tmp.Description"] = "Concealable machine pistol"
|
||||
|
||||
L["#Item.mac11.Name"] = "MAC-11"
|
||||
L["#Item.mac11.Description"] = "Tiny hornet gun"
|
||||
L["Item.mp5k.Name"] = "MP5K"
|
||||
L["Item.mp5k.Description"] = "High-quality SMG"
|
||||
|
||||
L["#Item.1887.Name"] = "1887"
|
||||
L["#Item.1887.Description"] = "Lever-action"
|
||||
L["Item.mp7.Name"] = "MP7"
|
||||
L["Item.mp7.Description"] = "Special forces PDW"
|
||||
|
||||
L["#Item.db.Name"] = "DB"
|
||||
L["#Item.db.Description"] = "Side-by-side shotgun"
|
||||
L["Item.mac11.Name"] = "MAC-11"
|
||||
L["Item.mac11.Description"] = "Tiny hornet gun"
|
||||
|
||||
L["#Item.aa12.Name"] = "AA-12"
|
||||
L["#Item.aa12.Description"] = "Automatic combat shotgun"
|
||||
L["Item.1887.Name"] = "1887"
|
||||
L["Item.1887.Description"] = "Lever-action"
|
||||
|
||||
L["#Item.striker.Name"] = "Streetsweeper"
|
||||
L["#Item.striker.Description"] = "Semi-automatic drum-fed shotgun"
|
||||
L["Item.db.Name"] = "DB"
|
||||
L["Item.db.Description"] = "Side-by-side shotgun"
|
||||
|
||||
L["#Item.r870.Name"] = "R870"
|
||||
L["#Item.r870.Description"] = "Sawn-off pump-action shotgun"
|
||||
L["Item.aa12.Name"] = "AA-12"
|
||||
L["Item.aa12.Description"] = "Automatic combat shotgun"
|
||||
|
||||
L["#Item.spas15.Name"] = "SPAS-15"
|
||||
L["#Item.spas15.Description"] = "Mag-fed pump-action shotgun"
|
||||
L["Item.striker.Name"] = "Streetsweeper"
|
||||
L["Item.striker.Description"] = "Semi-automatic drum-fed shotgun"
|
||||
|
||||
L["#Item.satchels.Name"] = "Satchels"
|
||||
L["#Item.satchels.Description"] = "Packs of bombs and a detonator"
|
||||
L["Item.r870.Name"] = "R870"
|
||||
L["Item.r870.Description"] = "Sawn-off pump-action shotgun"
|
||||
|
||||
L["#Item.toolgun.Name"] = "Tool gun"
|
||||
L["#Item.toolgun.Description"] = "Developer tools"
|
||||
L["Item.spas15.Name"] = "SPAS-15"
|
||||
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"
|
|
@ -14,12 +14,12 @@ local settings = {
|
|||
{
|
||||
name = "Camera",
|
||||
items = {
|
||||
{ type = TYPE_NUMBER, cvar = "b-cam_f", min = -200, max = 200, name = "Camera Forward" },
|
||||
{ type = TYPE_NUMBER, cvar = "b-cam_r", min = -30, max = 30, name = "Camera Right" },
|
||||
{ type = TYPE_NUMBER, cvar = "b-cam_u", min = -30, max = 30, name = "Camera Up" },
|
||||
{ type = TYPE_NUMBER, cvar = "b-cam_fov", min = 30, max = 120, name = "Camera FOV" },
|
||||
{ type = TYPE_BOOL, cvar = "b-cam_fp", name = "First-person Mode" },
|
||||
{ type = TYPE_NUMBER, cvar = "b-cam_fp_fov", min = 30, max = 120, name = "FP weapon FOV" },
|
||||
{ type = TYPE_NUMBER, cvar = "cam_f", min = -200, max = 200 },
|
||||
{ type = TYPE_NUMBER, cvar = "cam_r", min = -30, max = 30 },
|
||||
{ type = TYPE_NUMBER, cvar = "cam_u", min = -30, max = 30 },
|
||||
{ type = TYPE_NUMBER, cvar = "cam_fov", min = 30, max = 120 },
|
||||
{ type = TYPE_BOOL, cvar = "cam_fp" },
|
||||
{ type = TYPE_NUMBER, cvar = "cam_fp_fov", min = 30, max = 120 },
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -80,17 +80,17 @@ local entries = {
|
|||
SP:AddItem(Cat)
|
||||
|
||||
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
|
||||
local Changer = vgui.Create("DCheckBoxLabel", Cat)
|
||||
Changer:Dock( TOP )
|
||||
Changer:SetConVar( data.cvar )
|
||||
Changer:SetText( data.name )
|
||||
Changer:SetConVar( "b-" .. data.cvar )
|
||||
Changer:SetText( l8( "#Convar." .. data.cvar .. ".Name" ) )
|
||||
elseif data.type == TYPE_NUMBER then
|
||||
local Changer = vgui.Create("DNumSlider", Cat)
|
||||
Changer:Dock( TOP )
|
||||
Changer:SetConVar( data.cvar )
|
||||
Changer:SetText( data.name )
|
||||
Changer:SetConVar( "b-" .. data.cvar )
|
||||
Changer:SetText( l8( "#Convar." .. data.cvar .. ".Name" ) )
|
||||
Changer:SetMin( data.min )
|
||||
Changer:SetMax( data.max )
|
||||
Changer:SetDecimals( 0 )
|
||||
|
|
|
@ -0,0 +1,177 @@
|
|||
|
||||
if SERVER then return end
|
||||
|
||||
if util.IsBinaryModuleInstalled("gdiscord") then
|
||||
require("gdiscord")
|
||||
local RPC_AppID = "1287531216630976603"
|
||||
function DiscordUpdate()
|
||||
local rpc_data = {}
|
||||
|
||||
rpc_data["buttonPrimaryLabel"] = "Join Server"
|
||||
rpc_data["buttonPrimaryUrl"] = "steam://open/friends"-- .. "108.5.3.134:27015"
|
||||
rpc_data["buttonSecondaryLabel"] = "Join Server"
|
||||
rpc_data["buttonSecondaryUrl"] = "steam://open/friends"-- .. "108.5.3.134:27015"
|
||||
rpc_data["partySize"] = player.GetCount()
|
||||
rpc_data["partyMax"] = game.MaxPlayers()
|
||||
rpc_data["largeImageKey"] = "benny_1"--"map_b-mp_6t"
|
||||
rpc_data["largeImageText"] = "The Six Team Map"
|
||||
--rpc_data["smallImageKey"] = "doof2"
|
||||
--rpc_data["smallImageText"] = "Domination"
|
||||
|
||||
local NewTime = os.time() - math.floor(CurTime())
|
||||
|
||||
local modedata = BennyGame:GetModeData()
|
||||
local modename = modedata and l8( modedata.name ) or "(unknown)"
|
||||
|
||||
local details = modename .. " on " .. BennyGame:GetMapName()
|
||||
local title = ""
|
||||
if BennyGame:GetState() == BG_STATE_ACTIVE then
|
||||
rpc_data["startTimestamp"] = NewTime + BennyGame:GetRoundStartedAt()
|
||||
rpc_data["endTimestamp"] = NewTime + BennyGame:GetRoundStartedAt() + BennyGame:GetTimeLimit()
|
||||
|
||||
local myteam = LocalPlayer():Team()
|
||||
local myteamscore = BennyGame:GetScoreForTeam( myteam )
|
||||
|
||||
if BennyGame.RTeamID[ myteam ] then
|
||||
-- In play
|
||||
local BiggestScore = 0
|
||||
|
||||
for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do
|
||||
if RealTeamID == myteam then continue end
|
||||
BiggestScore = math.max( BiggestScore, BennyGame:GetScoreForTeam( RealTeamID ) )
|
||||
end
|
||||
|
||||
if myteamscore > BiggestScore then
|
||||
details = details .. " ▪ Winning"
|
||||
elseif myteamscore == BiggestScore then
|
||||
details = details .. " ▪ Tied"
|
||||
else
|
||||
details = details .. " ▪ Losing"
|
||||
end
|
||||
else
|
||||
details = details .. " ▪ Spectating"
|
||||
end
|
||||
|
||||
local first = true
|
||||
if BennyGame.RTeamID[ myteam ] then
|
||||
details = details .. " ▪ " .. myteamscore
|
||||
first = false
|
||||
else
|
||||
details = details .. " ▪ "
|
||||
end
|
||||
|
||||
for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do
|
||||
if RealTeamID == myteam then continue end
|
||||
details = details .. (first and "" or "-") .. BennyGame:GetScoreForTeam( RealTeamID ) -- placeholder, i need a thing
|
||||
first = false
|
||||
end
|
||||
|
||||
elseif BennyGame:GetState() == BG_STATE_PRE then
|
||||
rpc_data["startTimestamp"] = NewTime + BennyGame:GetPregameStartedAt()
|
||||
rpc_data["endTimestamp"] = NewTime + BennyGame:GetPregameStartedAt() + BennyGame:GetPregameTime()
|
||||
|
||||
title = "Pregame"
|
||||
elseif BennyGame:GetState() == BG_STATE_POST then
|
||||
rpc_data["startTimestamp"] = NewTime + BennyGame:GetRoundFinishedAt()
|
||||
rpc_data["endTimestamp"] = NewTime + BennyGame:GetRoundFinishedAt() + BennyGame:GetPostgameTime()
|
||||
|
||||
title = "Postgame"
|
||||
elseif BennyGame:GetState() == BG_STATE_WAITINGFORPLAYERS then
|
||||
rpc_data["startTimestamp"] = nil--NewTime + BennyGame:GetRoundFinishedAt() + BennyGame:GetPostgameTime()
|
||||
rpc_data["endTimestamp"] = nil
|
||||
|
||||
title = "Waiting for Players"
|
||||
end
|
||||
|
||||
rpc_data["details"] = details
|
||||
rpc_data["state"] = title
|
||||
|
||||
DiscordUpdateRPC(rpc_data)
|
||||
end
|
||||
hook.Add("Think", "RPresence_Think_Discord", function()
|
||||
if !RPC_Initialized then
|
||||
DiscordRPCInitialize(RPC_AppID)
|
||||
DiscordUpdate()
|
||||
RPC_Initialized = true
|
||||
RPC_NextUpdate = RealTime() + 1
|
||||
end
|
||||
if RPC_NextUpdate <= RealTime() then
|
||||
DiscordUpdate()
|
||||
RPC_NextUpdate = RealTime() + 1
|
||||
end
|
||||
end)
|
||||
else
|
||||
print("A module is missing: gdiscord")
|
||||
end
|
||||
|
||||
if util.IsBinaryModuleInstalled("steamrichpresencer") then
|
||||
require("steamrichpresencer")
|
||||
function SteamUpdate()
|
||||
local title = "Your Name Is Benny"
|
||||
--title = " ▪ Domination on SixT"
|
||||
--title = " ▪ Winning"
|
||||
--title = " ▪ 999-10"
|
||||
|
||||
local modedata = BennyGame:GetModeData()
|
||||
local modename = modedata and l8( modedata.name ) or "(unknown)"
|
||||
|
||||
title = title .. " ▪ " .. modename .. " on " .. BennyGame:GetMapName()
|
||||
if BennyGame:GetState() == BG_STATE_ACTIVE then
|
||||
local myteam = LocalPlayer():Team()
|
||||
local myteamscore = BennyGame:GetScoreForTeam( myteam )
|
||||
|
||||
if BennyGame.RTeamID[ myteam ] then
|
||||
-- In play
|
||||
local BiggestScore = 0
|
||||
|
||||
for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do
|
||||
if RealTeamID == myteam then continue end
|
||||
BiggestScore = math.max( BiggestScore, BennyGame:GetScoreForTeam( RealTeamID ) )
|
||||
end
|
||||
|
||||
if myteamscore > BiggestScore then
|
||||
title = title .. " ▪ Winning"
|
||||
elseif myteamscore == BiggestScore then
|
||||
title = title .. " ▪ Tied"
|
||||
else
|
||||
title = title .. " ▪ Losing"
|
||||
end
|
||||
else
|
||||
title = title .. " ▪ Spectating"
|
||||
end
|
||||
|
||||
local first = true
|
||||
if BennyGame.RTeamID[ myteam ] then
|
||||
title = title .. " ▪ " .. myteamscore
|
||||
first = false
|
||||
else
|
||||
title = title .. " ▪ "
|
||||
end
|
||||
|
||||
for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do
|
||||
if RealTeamID == myteam then continue end
|
||||
title = title .. (first and "" or "-") .. BennyGame:GetScoreForTeam( RealTeamID ) -- placeholder, i need a thing
|
||||
first = false
|
||||
end
|
||||
|
||||
elseif BennyGame:GetState() == BG_STATE_PRE then
|
||||
title = title .. " ▪ Pregame"
|
||||
elseif BennyGame:GetState() == BG_STATE_POST then
|
||||
title = title .. " ▪ Postgame"
|
||||
elseif BennyGame:GetState() == BG_STATE_WAITINGFORPLAYERS then
|
||||
title = title .. " ▪ Waiting for Players"
|
||||
end
|
||||
|
||||
steamworks.SetRichPresence("generic", title)
|
||||
steamworks.SetRichPresence("steam_player_group", tostring(BennyGame:GetUUID()) )
|
||||
steamworks.SetRichPresence("steam_player_group_size", tostring(#player.GetHumans()) )
|
||||
end
|
||||
hook.Add("Think", "RPresence_Think_Steam", function()
|
||||
if (Steam_NextUpdate or 0) <= RealTime() then
|
||||
SteamUpdate()
|
||||
Steam_NextUpdate = RealTime() + 1
|
||||
end
|
||||
end)
|
||||
else
|
||||
print("A module is missing: steamrichpresencer")
|
||||
end
|
|
@ -42,8 +42,13 @@ function TSelShared( tbl, seed )
|
|||
return tbl[math.Round( util.SharedRandom( seed, 1, #tbl ) )]
|
||||
end
|
||||
|
||||
-- Language might want to be loaded first
|
||||
-- Otherwise things will fail to call 'l8'
|
||||
AC("language.lua")
|
||||
IN("language.lua")
|
||||
|
||||
AC("convars.lua")
|
||||
IN("convars.lua")
|
||||
AC("camera.lua")
|
||||
IN("camera.lua")
|
||||
AC("items.lua")
|
||||
|
@ -61,6 +66,11 @@ IN("teams.lua")
|
|||
AC("pausemenu.lua")
|
||||
IN("pausemenu.lua")
|
||||
|
||||
AC("richpresence_test.lua")
|
||||
if CLIENT then
|
||||
IN("richpresence_test.lua")
|
||||
end
|
||||
|
||||
AC("debugmenu.lua")
|
||||
IN("debugmenu.lua")
|
||||
|
||||
|
|
Loading…
Reference in New Issue