mirror of
https://github.com/JonnyBro/beatrun.git
synced 2025-03-04 02:49:37 +05:00
some minor changes (not worth version change bacause not that many maps have space in the name)
This commit is contained in:
parent
1876c95130
commit
154a980f60
2 changed files with 15 additions and 17 deletions
|
@ -48,7 +48,7 @@ local function FetchCourse(url, headers)
|
||||||
if response and response.res == 200 then
|
if response and response.res == 200 then
|
||||||
print("Success! | Length: " .. length .. "\nLoading course...")
|
print("Success! | Length: " .. length .. "\nLoading course...")
|
||||||
|
|
||||||
local dir = "beatrun/courses/" .. currentMap .. "/"
|
local dir = "beatrun/courses/" .. string.Replace(currentMap, " ", "-") .. "/"
|
||||||
|
|
||||||
file.CreateDir(dir)
|
file.CreateDir(dir)
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ end
|
||||||
function UploadCourse()
|
function UploadCourse()
|
||||||
if Course_Name == "" or Course_ID == "" then return print(language.GetPhrase("beatrun.coursesdatabase.cantuploadfreeplay")) end
|
if Course_Name == "" or Course_ID == "" then return print(language.GetPhrase("beatrun.coursesdatabase.cantuploadfreeplay")) end
|
||||||
|
|
||||||
local fl = file.Open("beatrun/courses/" .. currentMap .. "/" .. Course_ID .. ".txt", "rb", "DATA")
|
local fl = file.Open("beatrun/courses/" .. string.Replace(currentMap, " ", "-") .. "/" .. Course_ID .. ".txt", "rb", "DATA")
|
||||||
local data = fl:Read()
|
local data = fl:Read()
|
||||||
|
|
||||||
PostCourse(domain:GetString() .. "/api/upload", util.Base64Encode(data, true), {
|
PostCourse(domain:GetString() .. "/api/upload", util.Base64Encode(data, true), {
|
||||||
|
@ -129,7 +129,7 @@ end)
|
||||||
function UpdateCourse(course_code)
|
function UpdateCourse(course_code)
|
||||||
if Course_Name == "" or Course_ID == "" then return print(language.GetPhrase("beatrun.coursesdatabase.cantuploadfreeplay")) end
|
if Course_Name == "" or Course_ID == "" then return print(language.GetPhrase("beatrun.coursesdatabase.cantuploadfreeplay")) end
|
||||||
|
|
||||||
local fl = file.Open("beatrun/courses/" .. currentMap .. "/" .. Course_ID .. ".txt", "rb", "DATA")
|
local fl = file.Open("beatrun/courses/" .. string.Replace(currentMap, " ", "-") .. "/" .. Course_ID .. ".txt", "rb", "DATA")
|
||||||
local data = fl:Read()
|
local data = fl:Read()
|
||||||
|
|
||||||
PostCourse(domain:GetString() .. "/api/update", data, {
|
PostCourse(domain:GetString() .. "/api/update", data, {
|
||||||
|
|
|
@ -41,7 +41,7 @@ buildmode_entmodels = {
|
||||||
|
|
||||||
local misc = {"models/hunter/misc/lift2x2.mdl", "models/hunter/misc/stair1x1.mdl", "models/hunter/misc/stair1x1inside.mdl", "models/hunter/misc/stair1x1outside.mdl", "models/props_combine/combine_barricade_short02a.mdl", "models/props_combine/combine_bridge_b.mdl", "models/props_docks/channelmarker_gib02.mdl", "models/props_docks/channelmarker_gib04.mdl", "models/props_docks/channelmarker_gib03.mdl", "models/props_lab/blastdoor001a.mdl", "models/props_lab/blastdoor001c.mdl", "models/props_wasteland/cargo_container01.mdl", "models/props_wasteland/cargo_container01b.mdl", "models/props_wasteland/cargo_container01c.mdl", "models/props_wasteland/horizontalcoolingtank04.mdl", "models/props_wasteland/laundry_washer001a.mdl", "models/props_wasteland/laundry_washer003.mdl", "models/props_junk/TrashDumpster01a.mdl", "models/props_junk/TrashDumpster02.mdl", "models/props_junk/wood_crate001a.mdl", "models/props_junk/wood_crate002a.mdl", "models/props_junk/wood_pallet001a.mdl", "models/props_c17/fence01a.mdl", "models/props_c17/fence01b.mdl", "models/props_c17/fence02a.mdl", "models/props_c17/fence03a.mdl", "models/props_c17/fence04a.mdl", "models/props_wasteland/interior_fence001g.mdl", "models/props_wasteland/interior_fence002d.mdl", "models/props_wasteland/interior_fence002e.mdl", "models/props_building_details/Storefront_Template001a_Bars.mdl", "models/props_wasteland/wood_fence01a.mdl", "models/props_wasteland/wood_fence02a.mdl", "models/props_c17/concrete_barrier001a.mdl", "models/props_wasteland/medbridge_base01.mdl", "models/props_wasteland/medbridge_post01.mdl", "models/props_wasteland/medbridge_strut01.mdl", "models/props_c17/column02a.mdl", "models/props_junk/iBeam01a_cluster01.mdl", "models/props_junk/iBeam01a.mdl", "models/props_canal/canal_cap001.mdl", "models/props_canal/canal_bridge04.mdl", "models/Mechanics/gears2/pinion_80t3.mdl", "models/props_phx/gears/rack36.mdl", "models/props_phx/gears/rack70.mdl", "models/cranes/crane_frame.mdl", "models/cranes/crane_docks.mdl", "models/props_wasteland/cranemagnet01a.mdl"}
|
local misc = {"models/hunter/misc/lift2x2.mdl", "models/hunter/misc/stair1x1.mdl", "models/hunter/misc/stair1x1inside.mdl", "models/hunter/misc/stair1x1outside.mdl", "models/props_combine/combine_barricade_short02a.mdl", "models/props_combine/combine_bridge_b.mdl", "models/props_docks/channelmarker_gib02.mdl", "models/props_docks/channelmarker_gib04.mdl", "models/props_docks/channelmarker_gib03.mdl", "models/props_lab/blastdoor001a.mdl", "models/props_lab/blastdoor001c.mdl", "models/props_wasteland/cargo_container01.mdl", "models/props_wasteland/cargo_container01b.mdl", "models/props_wasteland/cargo_container01c.mdl", "models/props_wasteland/horizontalcoolingtank04.mdl", "models/props_wasteland/laundry_washer001a.mdl", "models/props_wasteland/laundry_washer003.mdl", "models/props_junk/TrashDumpster01a.mdl", "models/props_junk/TrashDumpster02.mdl", "models/props_junk/wood_crate001a.mdl", "models/props_junk/wood_crate002a.mdl", "models/props_junk/wood_pallet001a.mdl", "models/props_c17/fence01a.mdl", "models/props_c17/fence01b.mdl", "models/props_c17/fence02a.mdl", "models/props_c17/fence03a.mdl", "models/props_c17/fence04a.mdl", "models/props_wasteland/interior_fence001g.mdl", "models/props_wasteland/interior_fence002d.mdl", "models/props_wasteland/interior_fence002e.mdl", "models/props_building_details/Storefront_Template001a_Bars.mdl", "models/props_wasteland/wood_fence01a.mdl", "models/props_wasteland/wood_fence02a.mdl", "models/props_c17/concrete_barrier001a.mdl", "models/props_wasteland/medbridge_base01.mdl", "models/props_wasteland/medbridge_post01.mdl", "models/props_wasteland/medbridge_strut01.mdl", "models/props_c17/column02a.mdl", "models/props_junk/iBeam01a_cluster01.mdl", "models/props_junk/iBeam01a.mdl", "models/props_canal/canal_cap001.mdl", "models/props_canal/canal_bridge04.mdl", "models/Mechanics/gears2/pinion_80t3.mdl", "models/props_phx/gears/rack36.mdl", "models/props_phx/gears/rack70.mdl", "models/cranes/crane_frame.mdl", "models/cranes/crane_docks.mdl", "models/props_wasteland/cranemagnet01a.mdl"}
|
||||||
|
|
||||||
for k, v in ipairs(misc) do
|
for _, v in ipairs(misc) do
|
||||||
local key = table.insert(buildmode_props, v:lower())
|
local key = table.insert(buildmode_props, v:lower())
|
||||||
propmatsblacklist[key] = true
|
propmatsblacklist[key] = true
|
||||||
end
|
end
|
||||||
|
@ -901,8 +901,9 @@ if CLIENT then
|
||||||
local save = {{}, {}, Course_StartPos, Course_StartAng, name or os.date("%H:%M:%S - %d/%m/%Y", os.time()), {}}
|
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
|
for _, v in pairs(buildmode_placed) do
|
||||||
if not IsValid(v) then -- Nothing
|
if not IsValid(v) then continue end
|
||||||
elseif v:GetNW2Bool("BRProtected") then
|
|
||||||
|
if v:GetNW2Bool("BRProtected") then
|
||||||
print("ignoring protected ent")
|
print("ignoring protected ent")
|
||||||
else
|
else
|
||||||
local class = v:GetClass()
|
local class = v:GetClass()
|
||||||
|
@ -961,7 +962,7 @@ if CLIENT then
|
||||||
concommand.Add("Beatrun_SaveCourse", function(ply, cmd, args, argstr)
|
concommand.Add("Beatrun_SaveCourse", function(ply, cmd, args, argstr)
|
||||||
local name = args[1] or os.date("%H:%M:%S - %d/%m/%Y", os.time())
|
local name = args[1] or os.date("%H:%M:%S - %d/%m/%Y", os.time())
|
||||||
|
|
||||||
SaveCourse(name, args[2])
|
SaveCourse(name, tobool(args[2]))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function LoadCourse(id)
|
function LoadCourse(id)
|
||||||
|
@ -1132,7 +1133,7 @@ if CLIENT then
|
||||||
local props = {}
|
local props = {}
|
||||||
local ents = {}
|
local ents = {}
|
||||||
|
|
||||||
for k, v in pairs(buildmode_selected) do
|
for k, _ in pairs(buildmode_selected) do
|
||||||
if buildmode_ents[k:GetClass()] then
|
if buildmode_ents[k:GetClass()] then
|
||||||
table.insert(ents, k)
|
table.insert(ents, k)
|
||||||
else
|
else
|
||||||
|
@ -1153,7 +1154,7 @@ if CLIENT then
|
||||||
if not dragging then
|
if not dragging then
|
||||||
local props = {}
|
local props = {}
|
||||||
|
|
||||||
for k, v in pairs(buildmode_selected) do
|
for k, _ in pairs(buildmode_selected) do
|
||||||
table.insert(props, k)
|
table.insert(props, k)
|
||||||
buildmode_selected[k] = nil
|
buildmode_selected[k] = nil
|
||||||
end
|
end
|
||||||
|
@ -1199,7 +1200,7 @@ if CLIENT then
|
||||||
else
|
else
|
||||||
local f = nil
|
local f = nil
|
||||||
|
|
||||||
for k, v in pairs(buildmode_selected) do
|
for k, _ in pairs(buildmode_selected) do
|
||||||
f = k
|
f = k
|
||||||
|
|
||||||
break
|
break
|
||||||
|
@ -1220,7 +1221,7 @@ if CLIENT then
|
||||||
local save = {}
|
local save = {}
|
||||||
local startpos = nil
|
local startpos = nil
|
||||||
|
|
||||||
for k, v in pairs(buildmode_selected) do
|
for k, _ in pairs(buildmode_selected) do
|
||||||
startpos = startpos or k:GetPos()
|
startpos = startpos or k:GetPos()
|
||||||
|
|
||||||
if not buildmode_props_index[k:GetModel()] then
|
if not buildmode_props_index[k:GetModel()] then
|
||||||
|
@ -1293,7 +1294,7 @@ if CLIENT then
|
||||||
dragging = false
|
dragging = false
|
||||||
|
|
||||||
if table.Count(buildmode_selected) > 0 then
|
if table.Count(buildmode_selected) > 0 then
|
||||||
for k, v in pairs(buildmode_selected) do
|
for k, _ in pairs(buildmode_selected) do
|
||||||
if IsValid(k) then
|
if IsValid(k) then
|
||||||
selected[k] = {
|
selected[k] = {
|
||||||
pos = k:GetRenderOrigin(),
|
pos = k:GetRenderOrigin(),
|
||||||
|
@ -1342,7 +1343,7 @@ if CLIENT then
|
||||||
end,
|
end,
|
||||||
[MOUSE_RIGHT] = function()
|
[MOUSE_RIGHT] = function()
|
||||||
if dragging and table.Count(buildmode_selected) > 0 then
|
if dragging and table.Count(buildmode_selected) > 0 then
|
||||||
for k, v in pairs(buildmode_selected) do
|
for k, _ in pairs(buildmode_selected) do
|
||||||
if IsValid(k) then
|
if IsValid(k) then
|
||||||
k:SetRenderOrigin(k.dragorigpos)
|
k:SetRenderOrigin(k.dragorigpos)
|
||||||
k:SetRenderAngles(k.dragorigang)
|
k:SetRenderAngles(k.dragorigang)
|
||||||
|
@ -1423,7 +1424,6 @@ if CLIENT then
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
local dragorigin = nil
|
local dragorigin = nil
|
||||||
|
|
||||||
function BuildModeDrag()
|
function BuildModeDrag()
|
||||||
|
@ -1457,7 +1457,6 @@ if CLIENT then
|
||||||
surface.SetDrawColor(0, 200, 0, 255)
|
surface.SetDrawColor(0, 200, 0, 255)
|
||||||
|
|
||||||
cam.Start3D()
|
cam.Start3D()
|
||||||
|
|
||||||
for _, v in ipairs(buildmode_placed) do
|
for _, v in ipairs(buildmode_placed) do
|
||||||
if IsValid(v) and not v:GetNW2Bool("BRProtected") then
|
if IsValid(v) and not v:GetNW2Bool("BRProtected") then
|
||||||
local pos = v:GetRenderOrigin() or v:GetPos()
|
local pos = v:GetRenderOrigin() or v:GetPos()
|
||||||
|
@ -1472,13 +1471,12 @@ if CLIENT then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cam.End3D()
|
cam.End3D()
|
||||||
|
|
||||||
if not dragging then
|
if not dragging then
|
||||||
dragorigin = nil
|
dragorigin = nil
|
||||||
|
|
||||||
for k, v in pairs(buildmode_selected) do
|
for k, _ in pairs(buildmode_selected) do
|
||||||
if IsValid(k) then
|
if IsValid(k) then
|
||||||
k.dragorigpos = k:GetPos()
|
k.dragorigpos = k:GetPos()
|
||||||
k.dragorigang = k:GetAngles()
|
k.dragorigang = k:GetAngles()
|
||||||
|
|
Loading…
Reference in a new issue