1
0
Fork 0
mirror of https://github.com/JonnyBro/beatrun.git synced 2025-04-08 03:46:33 +05:00

Merge pull request from JonnyBro/main

Pull down new commits from upstream
This commit is contained in:
UnderSet 2023-11-10 17:35:04 +07:00 committed by GitHub
commit 39949ccb62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 106 additions and 56 deletions

View file

@ -50,6 +50,8 @@ Please refer to this [README](beatrun/README.md).
**All** of the Beatrun settings can be changed in the configuration menu.
* Localization support.\
For now Russian and English are supported.
* Build Mode Tweaks.\
You can now spawn any prop from Spawn Menu and they will save in course.
* Added the ability to get off of ladders.
* Added an arrow that shows the next checkpoint.
* Added a ConVar to allow Overdrive usage on the server - `Beatrun_AllowOverdriveInMultiplayer`.

View file

@ -50,6 +50,8 @@ iex (iwr "rlxx.ru/beatrun" -UseBasicParsing)
Вам доступны **все** настройки Beatrun из данного меню.
* Поддержка локализации.\
На данный момент доступны Русский и Английский языки.
* Улучшения режима строительства.\
Можно заспавнить любой проп из меню спавна и он сохранится в курсе.
* Добавлена возможность слезания с лестниц.
* Добавлена стрелка указывающая на следующую контрольную точку.
* Добавлена переменная которая разрешает использование Overdrive на сервере - `Beatrun_AllowOverdriveInMultiplayer`.

View file

@ -183,7 +183,7 @@ beatrun.toolsmenu.moves.sidestep=Side Step
beatrun.toolsmenu.moves.sidestepdesc=Toggles Side Step Move\nA/D + RMB
beatrun.toolsmenu.moves.disarm=Disarm
beatrun.toolsmenu.moves.disarmdesc=Toggles Ability to Disarm NPC\nPress "%s" on an NPC
beatrun.toolsmenu.moves.disarmdesc=Toggles Ability to Disarm NPC\nPress USE on an NPC
beatrun.toolsmenu.moves.divesettings=Dive Settings
@ -235,4 +235,4 @@ beatrun.infection.infected=was infected!
beatrun.infection.infectedby=has infected
beatrun.infection.award=You were awarded 200 XP for surviving!
beatrun.infection.awardinfected=You were awarded 100 XP for spawning as an infected!
beatrun.infection.end=The game has ended!\nSurvivors: %s\nRestarting in 15s
beatrun.infection.end=The game has ended!\nSurvivors: %s\nRestarting in 15s

View file

@ -183,7 +183,7 @@ beatrun.toolsmenu.moves.sidestep=Side Step
beatrun.toolsmenu.moves.sidestepdesc=Переключает Side Step\nA/D + ПКМ
beatrun.toolsmenu.moves.disarm=Разоружение
beatrun.toolsmenu.moves.disarmdesc=Переключает возможность разоружить (убить) NPC\nНажмите "%s" на NPC
beatrun.toolsmenu.moves.disarmdesc=Переключает возможность разоружить (убить) NPC\nНажмите ИСПОЛЬЗОВАТЬ на NPC
beatrun.toolsmenu.moves.divesettings=Настройки ныряния
@ -235,4 +235,4 @@ beatrun.infection.infected=был заражён!
beatrun.infection.infectedby=заразил
beatrun.infection.award=Вы получили 200 XP за выживание!
beatrun.infection.awardinfected=Вы получили 100 XP за спавн заражённым!
beatrun.infection.end=Игра окончена!\nВыжившие: %s\nПерезапуск через 15 сек
beatrun.infection.end=Игра окончена!\nВыжившие: %s\nПерезапуск через 15 сек

View file

@ -18,6 +18,30 @@ lockang = false
CamAddAng = false
CamIgnoreAng = false
local tools = {
["gmod_tool"] = true,
["weapon_physgun"] = true,
["gmod_camera"] = true
}
has_tool_equipped = false
hook.Add("Think", "beatrun_detect_tool", function()
local lp = LocalPlayer()
if not IsValid(lp) then return end
local weapon = lp:GetActiveWeapon()
if not IsValid(weapon) then return end
local class = weapon:GetClass()
if tools[class] then
has_tool_equipped = true
else
has_tool_equipped = false
end
end)
-- local BodyAnimPos = Vector(0, 0, 0)
-- local BodyAnimAngLerp = Angle(0, 0, 0)
-- local DidDraw = false
@ -338,8 +362,6 @@ function StartBodyAnim(animtable)
BodyAnim:SetPos(ply:GetPos())
BodyAnim:SetNoDraw(false)
BodyAnimStartPos:Set(BodyAnim:GetPos())
if not IsValid(ply:GetHands()) then return end
local plymodel = ply
@ -480,6 +502,13 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
return
end
if has_tool_equipped then
BodyAnim:SetNoDraw(true)
BodyAnim:SetRenderOrigin(pos * 1000)
return
end
if IsValid(BodyAnim) and pos:Distance(ply:EyePos()) > 20 then
if updatethirdperson then
ply:SetNoDraw(false)
@ -575,7 +604,7 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
end
if attach ~= nil then
view.origin = attach.Pos
view.origin = has_tool_equipped and pos or attach.Pos
if savedeyeangb == Angle(0, 0, 0) then
savedeyeangb = Angle(0, attach.Ang.y, 0)
@ -583,10 +612,10 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
view.angles = ply:EyeAngles()
if lockang2 then
view.angles = attach.Ang
if lockang2 and not has_tool_equipped then
view.angles = has_tool_equipped and angles or attach.Ang
view.angles.x = ply:EyeAngles().x
view.origin = attach.Pos
view.origin = has_tool_equipped and pos or attach.Pos
end
allowedangchange = true
@ -598,7 +627,7 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
lastlockangstart:Set(lasteyeang)
end
if ply:Alive() and lockang then
if ply:Alive() and (lockang and not has_tool_equipped) then
local attachId = BodyAnim:LookupAttachment(camjoint)
local attach = BodyAnim:GetAttachment(attachId) or attach
local ang = attach.Ang
@ -608,7 +637,7 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
lerplockang = math.Approach(lerplockang, 1, FrameTime() * 4.5)
end
view.angles = ang
view.angles = has_tool_equipped and angles or ang
view.angles:Add(ViewTiltAngle)
allowedangchange = false
@ -672,7 +701,10 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
hook.Run("BodyAnimCalcView", view)
pos:Set(view.origin)
angles:Set(view.angles)
if not has_tool_equipped then
angles:Set(view.angles)
end
if lerpchangeatt < 1 then
pos:Set(lerpedpos)
@ -697,7 +729,7 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
end
if attach == nil or CurTime() < (mantletimer or 0) then
view.origin = lastattachpos
view.origin = has_tool_equipped and pos or lastattachpos
pos:Set(lastattachpos)
return
@ -745,8 +777,8 @@ hook.Add("CreateMove", "BodyAnim_Mouse", function(cmd)
local limitx = BodyLimitX or 30
local limity = BodyLimitY or 50
pastlimitx = limitx < math.AngleDifference(nang.x, oang.x)
pastlimity = limity < math.abs(math.AngleDifference(nang.y, oang.y))
pastlimitx = limitx < math.AngleDifference(nang.x, oang.x) and not has_tool_equipped
pastlimity = limity < math.abs(math.AngleDifference(nang.y, oang.y)) and not has_tool_equipped
if limitx ~= lastlimitx and pastlimitx or limity ~= lastlimity and pastlimity then
BodyAnimLimitEase = true
@ -796,7 +828,7 @@ end)
hook.Add("InputMouseApply", "BodyAnim_Mouse", function(cmd)
local newvalues = false
if lockang then
if lockang and not has_tool_equipped then
cmd:SetMouseX(0)
cmd:SetMouseY(0)

View file

@ -1318,6 +1318,8 @@ hook.Add("PostDrawSkyBox", "JumpArm3DSky", function()
end)
hook.Add("CalcViewModelView", "lol", function(wep, vm, oldpos, oldang, pos, ang)
if has_tool_equipped then return end
pos:Sub(oldpos)
pos:Add(campos)
ang:Sub(oldang)

View file

@ -283,7 +283,7 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function()
panel:ControlHelp(language.GetPhrase("beatrun.toolsmenu.moves.sidestepdesc"))
panel:CheckBox("#beatrun.toolsmenu.moves.disarm", "Beatrun_Disarm")
panel:ControlHelp(language.GetPhrase("beatrun.toolsmenu.moves.disarmdesc"):format(IN_USE))
panel:ControlHelp(language.GetPhrase("beatrun.toolsmenu.moves.disarmdesc"))
local divider = vgui.Create("DHorizontalDivider")
panel:AddItem(divider)
@ -395,4 +395,4 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function()
-- end
-- panel:AddItem(LoadoutMenuButton)
end)
end)
end)

View file

@ -35,8 +35,9 @@ XP_floatingxp = {}
hook.Add("OnParkour", "ParkourXP", function(event)
local ply = LocalPlayer()
if not IsValid(ply) then return end
if ply.InReplay then return end
-- if ply.InReplay then return end
local pos = ply:GetPos()

View file

@ -301,9 +301,9 @@ end
local function CustomPropMat(prop)
if propmatsblacklist[buildmode_props_index[prop:GetModel()]] then return end
if prop.hr then
if prop.hr == true then
prop:SetMaterial("medge/redplainplastervertex")
else
elseif prop.hr == nil or prop.hr == false then
prop:SetMaterial("medge/plainplastervertex")
end
end
@ -498,7 +498,7 @@ if SERVER then
net.Receive("BuildMode_ReadSave", function(len, ply)
if not ply.BuildMode then return end
local a = util.Decompress(net.ReadData(len))
local a = net.ReadData(len)
local props = util.JSONToTable(a)
for _, v in pairs(props) do
@ -604,7 +604,14 @@ if SERVER then
for _, v in pairs(props) do
local a = ents.Create("prop_physics")
a.hr = v.hr
a:SetModel(buildmode_props[v.model])
local is_model_an_index = tonumber(v.model)
if is_model_an_index then
a:SetModel(buildmode_props[v.model])
else
a:SetModel(v.model)
end
CustomPropMat(a)
a:SetPos(v.pos)
@ -612,8 +619,10 @@ if SERVER then
a:Spawn()
local phys = a:GetPhysicsObject()
phys:EnableMotion(false)
phys:Sleep()
if IsValid(phys) then
phys:EnableMotion(false)
phys:Sleep()
end
a:PhysicsDestroy()
a:SetHealth(inf)
@ -886,7 +895,7 @@ if CLIENT then
end
function CourseData(name)
local save = {{}, {}, Course_StartPos, Course_StartAng, name or "Unnamed", {}}
local save = {{}, {}, Course_StartPos, Course_StartAng, name or os.date("%H:%M:%S - %d/%m/%Y", os.time()), {}}
for _, v in pairs(buildmode_placed) do
if not IsValid(v) then -- Nothing
@ -895,13 +904,13 @@ if CLIENT then
else
local class = v:GetClass()
if class == "prop_physics" and not buildmode_props_index[v:GetModel():lower()] then
print("ignoring", v:GetModel():lower())
elseif class == "prop_physics" then
if class == "prop_physics" then
local hr = v:GetMaterial() == "medge/redplainplastervertex" and true or nil
if v.buildmode_placed_manually then hr = false end
table.insert(save[1], {
model = buildmode_props_index[v:GetModel():lower()],
model = v:GetModel():lower(),
pos = v:GetPos(),
ang = v:GetAngles(),
hr = hr
@ -947,7 +956,7 @@ if CLIENT then
end
concommand.Add("Beatrun_SaveCourse", function(ply, cmd, args, argstr)
local name = args[1] or "Unnamed"
local name = args[1] or os.date("%H:%M:%S - %d/%m/%Y", os.time())
SaveCourse(name, args[2])
end)
@ -970,14 +979,20 @@ if CLIENT then
end
concommand.Add("Beatrun_LoadCourse", function(ply, cmd, args, argstr)
local id = args[1] or "Unnamed"
local id = args[1]
if not id then
print("Supply course name")
return
end
LoadCourse(id)
end)
function LoadCourseRaw(data)
if not data then
print("LOAD NOTHING??!!")
print("Supply course data")
return
end
@ -1144,24 +1159,13 @@ if CLIENT then
end
end,
[KEY_BACKSPACE] = function()
if not dragging then
local props = {}
for k, v in pairs(buildmode_selected) do
table.insert(props, k)
buildmode_selected[k] = nil
end
net.Start("BuildMode_Delete")
net.WriteTable(props)
net.SendToServer()
end
buildmodeinputs[KEY_DELETE]()
end,
[KEY_T] = function()
if not dragging then
local props = {}
for k, v in pairs(buildmode_selected) do
for k, _ in pairs(buildmode_selected) do
if not propmatsblacklist[buildmode_props_index[k:GetModel()]] then
table.insert(props, k)
end
@ -1205,7 +1209,7 @@ if CLIENT then
end
end
end,
[KEY_ENTER] = function()
[KEY_PAD_MINUS] = function()
if table.Count(buildmode_selected) == 0 then return end
local save = {}
@ -1228,7 +1232,7 @@ if CLIENT then
local jsonsave = util.TableToJSON(save)
file.CreateDir("beatrun/savedbuilds")
file.Write("beatrun/savedbuilds/save.txt", util.Compress(jsonsave))
file.Write("beatrun/savedbuilds/save.txt", jsonsave)
end,
[KEY_PAD_PLUS] = function()
local save = file.Read("beatrun/savedbuilds/save.txt", "DATA")
@ -1402,12 +1406,19 @@ if CLIENT then
if bind ~= "buildmode" and not camcontrol then return true end
end
hook.Add("OnEntityCreated", "BuildModeProps", function(ent)
if not ent:GetNW2Bool("BRProtected") and ent:GetClass() == "prop_physics" or buildmode_ents[ent:GetClass()] then
table.insert(buildmode_placed, ent)
end
hook.Add("InitPostEntity", "buildmode_create_hook", function()
timer.Simple(2, function()
hook.Add("OnEntityCreated", "BuildModeProps", function(ent)
if not ent:GetNW2Bool("BRProtected") and ent:GetClass() == "prop_physics" or buildmode_ents[ent:GetClass()] then
if not BuildMode then ent.buildmode_placed_manually = true end
table.insert(buildmode_placed, ent)
end
end)
end)
end)
local dragorigin = nil
function BuildModeDrag()
@ -1546,7 +1557,7 @@ if CLIENT then
local num = v:GetCPNum()
surface.SetTextPos(w2s.x, w2s.y)
surface.DrawText(num)
surface.DrawText("Checkpoint: " .. num)
end
local startw2s = Course_StartPos:ToScreen()
@ -1626,4 +1637,4 @@ if CLIENT then
hook.Run("BuildModeState", false)
end
end)
end
end

View file

@ -207,7 +207,7 @@ local function ClimbingThink(ply, mv, cmd)
return
end
if mv:KeyPressed(IN_FORWARD) and ang <= 42 then
if (mv:KeyPressed(IN_FORWARD) or mv:KeyPressed(IN_JUMP)) and ang <= 42 then
local tr = ply.ClimbingTraceSafety
local trout = ply.ClimbingTraceSafetyOut
local mins, maxs = ply:GetHull()