Added zone detection

master
E. Almqvist 5 years ago
parent de7d562b47
commit e48c001951
  1. 11
      gamemode/engine/lib/server/sv_property.lua
  2. 2
      gamemode/engine/lib/server/sv_zone.lua
  3. 1
      gamemode/init.lua
  4. 13
      gamemode/settings/sv_properties.lua

@ -39,3 +39,14 @@ function Quantum.Server.Property.Get( propid ) return Quantum.Server.Property.Pr
function Quantum.Server.Property.SetOwner( propid, charid ) function Quantum.Server.Property.SetOwner( propid, charid )
Quantum.Server.Property.Properties[propid].owner = charid Quantum.Server.Property.Properties[propid].owner = charid
end end
hook.Add( "Move", "Quantum_Move_Property_CheckInZone", function( ply, mv )
if( ply.isloaded ) then
if( mv:GetVelocity() != Vector( 0, 0, 0 ) ) then
local zone = Quantum.Server.Zone.GetCurrentZone( ply:GetPos() )
if( zone != nil ) then
ply:ChatPrint( zone.name )
end
end
end
end)

@ -10,7 +10,7 @@ Quantum.Server.Zone = {}
Quantum.Server.Zone.Zones = {} -- all zones are rectangles where they go from vec1 to vec2 Quantum.Server.Zone.Zones = {} -- all zones are rectangles where they go from vec1 to vec2
function Quantum.Server.Zone.Register( zoneid, tbl ) function Quantum.Server.Zone.Register( zoneid, tbl )
if( Quantum.Server.Zone.Zones[zoneid] != nil ) then if( Quantum.Server.Zone.Zones[zoneid] == nil ) then
local zone = { local zone = {
name = tbl.name || "Unknown Zone", name = tbl.name || "Unknown Zone",
id = zoneid, id = zoneid,

@ -123,6 +123,7 @@ if SERVER then
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" ) include( "settings/sv_nodes_locations.lua" )
include( "settings/sv_properties.lua" )
Quantum.Server.Station.UpdateAll() Quantum.Server.Station.UpdateAll()
end end

@ -0,0 +1,13 @@
-- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Server.Property.Register( "house1", {
name = "Red House",
price = 10000,
vec1 = Vector( 761.43292236328, -3089.3618164063, 200.19812011719 ),
vec2 = Vector(-931.62518310547, -5161.078125, 1534.8125)
})
Loading…
Cancel
Save