Bug fixes & nodes update

master
AlmTech Software 5 years ago
parent 9edf95c0e7
commit 15e2852b82
  1. 21
      gamemode/engine/lib/sh_node.lua
  2. 1
      gamemode/init.lua
  3. 10
      gamemode/settings/sv_nodes_locations.lua

@ -7,6 +7,7 @@
Quantum.Node = {} -- lib Quantum.Node = {} -- lib
Quantum.Nodes = {} -- container for vars Quantum.Nodes = {} -- container for vars
Quantum.NodesLocations = {}
function Quantum.Node.Create( nodeid, tbl ) function Quantum.Node.Create( nodeid, tbl )
local node = { local node = {
@ -65,15 +66,24 @@ if SERVER then
end end
end end
function Quantum.Node.RemoveAllPerma()
for k, node in pairs( ents.FindByClass("q_node") ) do
node:Remove()
end
end
function Quantum.Node.Register( nodeid, vec, ang1 ) function Quantum.Node.Register( nodeid, vec, ang1 )
Quantum.Nodes[ #Quantum.Nodes + 1 ] = { id = nodeid, pos = vec, ang = ang1 } Quantum.NodesLocations[ #Quantum.NodesLocations + 1 ] = { id = nodeid, pos = vec, ang = ang1 }
end end
function Quantum.Node.SpawnAllRegistered() function Quantum.Node.SpawnAllRegistered()
local nodeTbl local nodeTbl
for k, v in pairs( Quantum.Nodes ) do for k, v in pairs( Quantum.NodesLocations ) do
nodeTbl = Quantum.Node.Get( v.id ) nodeTbl = Quantum.Node.Get( v.id )
if( nodeTbl != nil ) then if( nodeTbl != nil ) then
Quantum.Debug( "----Node-Spawning-Info----" )
PrintTable(v)
Quantum.Debug( "--------------------------" )
Quantum.Node.Spawn( v.id, v.pos, v.ang, nodeTbl.respawndelay, nodeTbl.probability ) Quantum.Node.Spawn( v.id, v.pos, v.ang, nodeTbl.respawndelay, nodeTbl.probability )
else else
Quantum.Error( "Tried to spawn an invalid node ('" .. v.id .. "')!" ) Quantum.Error( "Tried to spawn an invalid node ('" .. v.id .. "')!" )
@ -89,6 +99,13 @@ if SERVER then
end end
end) end)
hook.Add( "PlayerDisconnected", "Quantum_Nodes_RemoveOnNoPlayers", function()
Quantum.Debug( "Removing all nodes..." )
if( #player.GetAll() - 1 <= 0 ) then
Quantum.Node.RemoveAllPerma()
end
end)
local function randomizeLootTable( tbl, prob ) local function randomizeLootTable( tbl, prob )
local n = math.Rand( 0.00000000001, 1 ) local n = math.Rand( 0.00000000001, 1 )
Quantum.Debug( "Probability: " .. n .. " <= " .. prob ) Quantum.Debug( "Probability: " .. n .. " <= " .. prob )

@ -122,6 +122,7 @@ if SERVER then
include( "settings/sh_recipes.lua" ) include( "settings/sh_recipes.lua" )
include( "settings/sv_crafting_stations_locations.lua" ) include( "settings/sv_crafting_stations_locations.lua" )
include( "settings/sh_nodes.lua" ) include( "settings/sh_nodes.lua" )
include( "settings/sv_nodes_locations.lua" )
Quantum.Server.Station.UpdateAll() Quantum.Server.Station.UpdateAll()
end end

@ -0,0 +1,10 @@
-- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Node.Register( "stone", Vector( 14877.728515625, -916.02612304688, 768 ), Angle( 0, -139.03350830078, 0 ) )
Loading…
Cancel
Save