mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-27 20:43:02 +05:00
new gamemode + some fixes to gamemodes
This commit is contained in:
parent
d2f29fb17f
commit
519a16cd50
29 changed files with 149 additions and 38 deletions
|
@ -32,6 +32,7 @@ Installer's source can be found [here](/BeatrunAnimInstaller).
|
|||
|
||||
## Changes and fixes done by me
|
||||
* Created a [custom online courses database](https://courses.beatrun.ru), which is also free and [open source](https://github.com/relaxtakenotes/beatrun-courses-server/) 🤯!
|
||||
* Added a new gamemode - *Deathmatch*, it's like Data Theft, but you collect kills not cubes!
|
||||
* Added an in-game config menu - You can find it in the tool menu, in the *Beatrun* Category!\
|
||||
All of the settings below can be changed in the configuration menu.
|
||||
* Added the ability Getting off of ladders.
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -13,8 +13,6 @@ AddCSLuaFile()
|
|||
ENT.Model = "models/hunter/blocks/cube05x05x05.mdl"
|
||||
ENT.DataCube = true
|
||||
|
||||
local color_green = Color(0, 255, 0)
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel(self.Model)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
|
@ -31,7 +29,7 @@ function ENT:Initialize()
|
|||
self:GetPhysicsObject():SetVelocity(randvec)
|
||||
end
|
||||
|
||||
self:SetColor(color_green)
|
||||
self:SetColor(Color(0, 255, 0))
|
||||
self:SetCustomCollisionCheck(true)
|
||||
end
|
||||
|
||||
|
|
|
@ -383,7 +383,7 @@ function SWEP:OnRemove()
|
|||
end
|
||||
|
||||
function SWEP:Reload()
|
||||
if GetGlobalBool(GM_DATATHEFT) then return end
|
||||
if GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) then return end
|
||||
|
||||
if not TUTORIALMODE and CurTime() > self.RespawnDelay and self:GetOwner():GetClimbing() == 0 and not IsValid(self:GetOwner():GetSwingbar()) and not self:GetOwner().BuildMode then
|
||||
self:GetOwner():Spawn()
|
||||
|
|
|
@ -303,6 +303,19 @@ local function sortleaderboard(a, b)
|
|||
btime = -1
|
||||
end
|
||||
|
||||
return atime > btime
|
||||
elseif GetGlobalBool(GM_DEATHMATCH) then
|
||||
atime = a:GetNW2Int("DeathmatchKills", 0)
|
||||
btime = b:GetNW2Int("DeathmatchKills", 0)
|
||||
|
||||
if atime == 0 then
|
||||
atime = -1
|
||||
end
|
||||
|
||||
if btime == 0 then
|
||||
btime = -1
|
||||
end
|
||||
|
||||
return atime > btime
|
||||
else
|
||||
if atime == 0 then
|
||||
|
@ -318,10 +331,11 @@ local function sortleaderboard(a, b)
|
|||
end
|
||||
|
||||
function BeatrunLeaderboard(forced)
|
||||
if not forced and Course_Name == "" and not GetGlobalBool(GM_INFECTION) and not GetGlobalBool(GM_DATATHEFT) then return end
|
||||
if not forced and Course_Name == "" and not GetGlobalBool(GM_INFECTION) and not GetGlobalBool(GM_DATATHEFT) and not GetGlobalBool(GM_DEATHMATCH) then return end
|
||||
|
||||
local isinfection = GetGlobalBool(GM_INFECTION)
|
||||
local isdatatheft = GetGlobalBool(GM_DATATHEFT)
|
||||
local isdeathmatch = GetGlobalBool(GM_DEATHMATCH)
|
||||
local ply = LocalPlayer()
|
||||
local vp = ply:GetViewPunchAngles()
|
||||
local scrh = ScrH()
|
||||
|
@ -364,6 +378,10 @@ function BeatrunLeaderboard(forced)
|
|||
pbtimenum = v:GetNW2Int("DataBanked", 0)
|
||||
pbtime = pbtimenum
|
||||
surface.SetTextColor(pbtimenum ~= 0 and placecolors[k] or color_white)
|
||||
elseif isdeathmatch then
|
||||
pbtimenum = v:GetNW2Int("DeathmatchKills", 0)
|
||||
pbtime = pbtimenum
|
||||
surface.SetTextColor(pbtimenum ~= 0 and placecolors[k] or color_white)
|
||||
else
|
||||
surface.SetTextColor(pbtimenum ~= 0 and placecolors[k] or color_white)
|
||||
|
||||
|
|
|
@ -295,7 +295,11 @@ local armlock = {
|
|||
ladderclimbuprighthand = true,
|
||||
ladderclimbhangstart = true,
|
||||
vaultontohigh = true,
|
||||
snatchscar = true
|
||||
snatchscar = true,
|
||||
wallrunright = true,
|
||||
wallrunleft = true,
|
||||
wallrunrightstart = true,
|
||||
wallrunleftstart = true
|
||||
}
|
||||
|
||||
local stillanims = {
|
||||
|
@ -439,11 +443,7 @@ local worldarm = {
|
|||
ladderclimbhangstart = true,
|
||||
snatchscar = true,
|
||||
jumpcoil = true,
|
||||
jumpturnlandidle = true,
|
||||
wallrunright = true,
|
||||
wallrunleft = true,
|
||||
wallrunrightstart = true,
|
||||
wallrunleftstart = true
|
||||
jumpturnlandidle = true
|
||||
}
|
||||
|
||||
local ignorezarm = {
|
||||
|
|
|
@ -4,7 +4,7 @@ local enemy = Color(255, 0, 0)
|
|||
|
||||
local function HideNearby(ply)
|
||||
if ply == LocalPlayer() then return end
|
||||
if GetGlobalBool(GM_DATATHEFT) then return end
|
||||
if GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) then return end
|
||||
|
||||
ply.distfromlocal = LocalPlayer():GetPos():Distance(ply:GetPos())
|
||||
local Distance = ply.distfromlocal or 40000
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
local function StartInfection()
|
||||
local function ToggleGamemode(gm)
|
||||
net.Start("Beatrun_ToggleGamemode")
|
||||
net.WriteString("infection")
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
local function StartDataTheft()
|
||||
net.Start("Beatrun_ToggleGamemode")
|
||||
net.WriteString("datatheft")
|
||||
net.WriteString(gm)
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
|
@ -306,7 +300,7 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function()
|
|||
InfectionButton:SetText("Toggle Infection Gamemode")
|
||||
InfectionButton:SetSize(0, 20)
|
||||
InfectionButton.DoClick = function()
|
||||
if GetGlobalBool(GM_DATATHEFT) then
|
||||
if GetGlobalBool(GM_DEATHMATCH) or GetGlobalBool(GM_DATATHEFT) then
|
||||
InfectionButton:SetText("Another gamemode is running!")
|
||||
timer.Simple(2, function()
|
||||
InfectionButton:SetText("Toggle Infection Gamemode")
|
||||
|
@ -314,7 +308,7 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function()
|
|||
return
|
||||
end
|
||||
|
||||
StartInfection()
|
||||
ToggleGamemode("infection")
|
||||
end
|
||||
panel:AddItem(InfectionButton)
|
||||
|
||||
|
@ -322,18 +316,34 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function()
|
|||
DatatheftButton:SetText("Toggle Data Theft Gamemode")
|
||||
DatatheftButton:SetSize(0, 20)
|
||||
DatatheftButton.DoClick = function()
|
||||
if GetGlobalBool(GM_INFECTION) then
|
||||
InfectionButton:SetText("Another gamemode is running!")
|
||||
if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DEATHMATCH) then
|
||||
DatatheftButton:SetText("Another gamemode is running!")
|
||||
timer.Simple(2, function()
|
||||
InfectionButton:SetText("Toggle Data Theft Gamemode")
|
||||
DatatheftButton:SetText("Toggle Data Theft Gamemode")
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
StartDataTheft()
|
||||
ToggleGamemode("datatheft")
|
||||
end
|
||||
panel:AddItem(DatatheftButton)
|
||||
|
||||
local DeathmatchButton = vgui.Create("DButton", panel)
|
||||
DeathmatchButton:SetText("Toggle Deathmatch Gamemode")
|
||||
DeathmatchButton:SetSize(0, 20)
|
||||
DeathmatchButton.DoClick = function()
|
||||
if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) then
|
||||
DeathmatchButton:SetText("Another gamemode is running!")
|
||||
timer.Simple(2, function()
|
||||
DeathmatchButton:SetText("Toggle Deathmatch Gamemode")
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
ToggleGamemode("deathmatch")
|
||||
end
|
||||
panel:AddItem(DeathmatchButton)
|
||||
|
||||
-- local divider = vgui.Create("DHorizontalDivider")
|
||||
-- panel:AddItem(divider)
|
||||
|
||||
|
|
|
@ -130,10 +130,10 @@ function PLAYER:SetupDataTables()
|
|||
end
|
||||
|
||||
function PLAYER:Loadout()
|
||||
if GetGlobalBool(GM_DATATHEFT) then
|
||||
if GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) then
|
||||
for k, v in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do
|
||||
local wep = self.Player:Give(v)
|
||||
self.Player:GiveAmmo(300, wep:GetPrimaryAmmoType())
|
||||
self.Player:GiveAmmo(1000, wep:GetPrimaryAmmoType())
|
||||
end
|
||||
else
|
||||
self.Player:RemoveAllAmmo()
|
||||
|
@ -141,6 +141,7 @@ function PLAYER:Loadout()
|
|||
|
||||
self.Player:Give("runnerhands")
|
||||
self.Player:SelectWeapon("runnerhands")
|
||||
|
||||
self.Player:SetJumpPower(230)
|
||||
self.Player:SetCrouchedWalkSpeed(0.5)
|
||||
self.Player:SetFOV(self.Player:GetInfoNum("Beatrun_FOV", 120))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
GM_DATATHEFT = 1
|
||||
GM_DATATHEFT = 0
|
||||
DATATHEFT_LOADOUTS = {
|
||||
{"weapon_357", "weapon_ar2"}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ if SERVER then
|
|||
else
|
||||
for l, b in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do
|
||||
local wep = v:Give(b)
|
||||
v:GiveAmmo(300, wep:GetPrimaryAmmoType())
|
||||
v:GiveAmmo(1000, wep:GetPrimaryAmmoType())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -95,10 +95,8 @@ if CLIENT then
|
|||
hook.Add("BeatrunHUDCourse", "DataTheftHUDName", DataTheftHUDName)
|
||||
end)
|
||||
|
||||
local chatcolor = Color(200, 200, 200)
|
||||
|
||||
net.Receive("DataTheft_Start", function()
|
||||
hook.Add("BeatrunHUDCourse", "DataTheftHUDName", DataTheftHUDName)
|
||||
chat.AddText(chatcolor, "Data Theft! Kill players to collect data, deposit data in banks")
|
||||
chat.AddText(Color(200, 200, 200), "Data Theft! Kill players to collect data, deposit data in banks")
|
||||
end)
|
||||
end
|
81
beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua
Normal file
81
beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua
Normal file
|
@ -0,0 +1,81 @@
|
|||
GM_DEATHMATCH = 0
|
||||
|
||||
if SERVER then
|
||||
util.AddNetworkString("Deathmatch_Start")
|
||||
util.AddNetworkString("Deathmatch_Sync")
|
||||
|
||||
function Beatrun_StartDeathmatch()
|
||||
SetGlobalBool(GM_DEATHMATCH, true)
|
||||
|
||||
net.Start("Deathmatch_Start")
|
||||
net.Broadcast()
|
||||
|
||||
for _, v in ipairs(player.GetAll()) do
|
||||
if v:GetMoveType() == MOVETYPE_NOCLIP then
|
||||
v:SetMoveType(MOVETYPE_WALK)
|
||||
v:Spawn()
|
||||
else
|
||||
for _, b in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do
|
||||
local wep = v:Give(b)
|
||||
v:GiveAmmo(1000, wep:GetPrimaryAmmoType())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Beatrun_StopDeathmatch()
|
||||
SetGlobalBool(GM_DEATHMATCH, false)
|
||||
|
||||
for _, v in ipairs(player.GetAll()) do
|
||||
v:StripWeapons()
|
||||
v:StripAmmo()
|
||||
v:Give("runnerhands")
|
||||
end
|
||||
end
|
||||
|
||||
local function DeathmatchSync(ply)
|
||||
if GetGlobalBool(GM_DEATHMATCH) and not ply.DeathmatchSynced then
|
||||
net.Start("Deathmatch_Sync")
|
||||
net.Send(ply)
|
||||
|
||||
ply.DeathmatchSynced = true
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add("PlayerSpawn", "DeathmatchSync", DeathmatchSync)
|
||||
|
||||
local function DeathmatchDeath(ply, inflictor, attacker)
|
||||
if GetGlobalBool(GM_DEATHMATCH) then
|
||||
local plyKills = ply:GetNW2Int("DeathmatchKills", 0)
|
||||
|
||||
if ply == attacker then
|
||||
ply:SetNW2Int("DeathmatchKills", plyKills - 1)
|
||||
elseif IsValid(attacker) and attacker ~= ply then
|
||||
local kills = attacker:GetNW2Int("DeathmatchKills", 0)
|
||||
|
||||
attacker:SetNW2Int("DeathmatchKills", kills + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add("PlayerDeath", "DeathmatchDeath", DeathmatchDeath)
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
local function DeathmatchHUDName()
|
||||
if GetGlobalBool(GM_DEATHMATCH) then
|
||||
return "Deathmatch"
|
||||
else
|
||||
hook.Remove("BeatrunHUDCourse", "DeathmatchHUDName")
|
||||
end
|
||||
end
|
||||
|
||||
net.Receive("Deathmatch_Sync", function()
|
||||
hook.Add("BeatrunHUDCourse", "DeathmatchHUDName", DeathmatchHUDName)
|
||||
end)
|
||||
|
||||
net.Receive("Deathmatch_Start", function()
|
||||
hook.Add("BeatrunHUDCourse", "DeathmatchHUDName", DeathmatchHUDName)
|
||||
chat.AddText(Color(200, 200, 200), "Deathmatch! Kill players to get points!")
|
||||
end)
|
||||
end
|
|
@ -14,7 +14,7 @@ if CLIENT then
|
|||
|
||||
if IsValid(activewep) and activewep:GetClass() ~= "runnerhands" then return end
|
||||
if ply:GetMoveType() == MOVETYPE_NOCLIP then return end
|
||||
if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) then return end
|
||||
if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) then return end
|
||||
|
||||
if not ply.GrappleHUD_tr then
|
||||
ply.GrappleHUD_tr = {}
|
||||
|
@ -58,7 +58,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
|
|||
if ply:GetMantle() ~= 0 or ply:GetClimbing() ~= 0 then return end
|
||||
if ply:GetInfoNum("Beatrun_DisableGrapple", 0) == 1 and Course_Name == "" then return end
|
||||
if not ply:Alive() or Course_Name ~= "" and ply:GetNW2Int("CPNum", 1) ~= -1 and not ply:GetNW2Entity("Swingrope"):IsValid() then return end
|
||||
if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) and not ply:GetNW2Entity("Swingrope"):IsValid() then return end
|
||||
if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) and not ply:GetNW2Entity("Swingrope"):IsValid() then return end
|
||||
|
||||
local activewep = ply:GetActiveWeapon()
|
||||
local usingrh = IsValid(activewep) and activewep:GetClass() == "runnerhands"
|
||||
|
|
|
@ -36,7 +36,7 @@ hook.Add("PlayerNoClip", "BlockNoClip", function(ply, enabled)
|
|||
end
|
||||
end
|
||||
|
||||
if enabled and (GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT)) then return false end
|
||||
if enabled and (GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH)) then return false end
|
||||
end)
|
||||
|
||||
function ParkourEvent(event, ply, ignorepred)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
--Kicks people net spamming so the server doesn't eat shit
|
||||
--Just a pasta of net.Incoming with an added check
|
||||
if game.SinglePlayer() then return end
|
||||
|
||||
local maxmsgcount = 100
|
|
@ -17,5 +17,11 @@ net.Receive("Beatrun_ToggleGamemode", function(_, ply)
|
|||
else
|
||||
Beatrun_StopInfection()
|
||||
end
|
||||
elseif gm == "deathmatch" then
|
||||
if not GetGlobalBool(GM_DEATHMATCH) then
|
||||
Beatrun_StartDeathmatch()
|
||||
else
|
||||
Beatrun_StopDeathmatch()
|
||||
end
|
||||
end
|
||||
end)
|
Loading…
Reference in a new issue