diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-02-28 18:09:58 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-02-28 18:09:58 -0500 |
| commit | 403e81b9eecb9a86bef5985425f81df577af7837 (patch) | |
| tree | c7ccabc294f9ecca493a9b1c114acc6e1772569d /gamemode | |
| parent | 5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162 (diff) | |
| download | artery-403e81b9eecb9a86bef5985425f81df577af7837.tar.gz artery-403e81b9eecb9a86bef5985425f81df577af7837.tar.bz2 artery-403e81b9eecb9a86bef5985425f81df577af7837.zip | |
Breaking redirect to implement a better system
Diffstat (limited to 'gamemode')
| -rw-r--r-- | gamemode/client/cl_inventory.lua | 2 | ||||
| -rw-r--r-- | gamemode/client/cl_legs.lua | 2 | ||||
| -rw-r--r-- | gamemode/core/database/sv_setup.lua | 6 | ||||
| -rw-r--r-- | gamemode/core/npc/sv_npcsystem.lua | 2 | ||||
| -rw-r--r-- | gamemode/npcsystem/sv_examplenpc.lua | 51 | ||||
| -rw-r--r-- | gamemode/nrequire.lua | 4 |
6 files changed, 62 insertions, 5 deletions
diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 1887559..65c3ceb 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -143,6 +143,7 @@ local previousheadscale = Vector(1,1,1) local toggle_arteryview = false hook.Add("CalcView","ArteryInventoryView",function(ply,pos,ang,fov,nearz,farz) if not toggle_arteryview then return end + local view = {} if state.invopen then local trot = math.rad(CurTime() * rotatespeed) local xoff = viewdistance * math.sin(trot) @@ -154,7 +155,6 @@ hook.Add("CalcView","ArteryInventoryView",function(ply,pos,ang,fov,nearz,farz) if bone == nil then bone = LocalPlayer():LookupBone("ValveBiped.Bip01_Head1") end - local view = {} local tr = util.TraceLine({ start = pos, endpos = (ang:Forward() * -100) + pos, diff --git a/gamemode/client/cl_legs.lua b/gamemode/client/cl_legs.lua index 53f8cf4..0a8ce3a 100644 --- a/gamemode/client/cl_legs.lua +++ b/gamemode/client/cl_legs.lua @@ -1,3 +1,5 @@ +do return end + --[[ Made by Valkyrie diff --git a/gamemode/core/database/sv_setup.lua b/gamemode/core/database/sv_setup.lua index dd2332d..a99cef4 100644 --- a/gamemode/core/database/sv_setup.lua +++ b/gamemode/core/database/sv_setup.lua @@ -68,9 +68,9 @@ function sql.GetPlayerData(ply) local mtbl = util.JSONToTable(meta) if mtbl.lastserver ~= game.GetIPAddress() then --ply:ConCommand("connect " .. mtbl.lastserver) - net.Start("art_sendtoserver") - net.WriteString(mtbl.lastserver) - net.Send(ply) + -- net.Start("art_sendtoserver") + -- net.WriteString(mtbl.lastserver) + -- net.Send(ply) return nil end local _,_,x,y,z = string.find(mtbl.lastlocation,"([-%d%.]+) ([-%d%.]+) ([-%d%.]+)") diff --git a/gamemode/core/npc/sv_npcsystem.lua b/gamemode/core/npc/sv_npcsystem.lua index d376d6d..7c75f90 100644 --- a/gamemode/core/npc/sv_npcsystem.lua +++ b/gamemode/core/npc/sv_npcsystem.lua @@ -10,7 +10,7 @@ local autocompletef ---Registers an NPC. -- Adds an npc to the global table. NPC's should have unique .Name fields, if they don't, this function will error. ---@see npc +--@see npctbl --@tparam table npc The npc's table. function n.RegisterNPC(npc) assert(npc ~= nil, "Attempted to register a nil npc") diff --git a/gamemode/npcsystem/sv_examplenpc.lua b/gamemode/npcsystem/sv_examplenpc.lua new file mode 100644 index 0000000..9e8f5ec --- /dev/null +++ b/gamemode/npcsystem/sv_examplenpc.lua @@ -0,0 +1,51 @@ +---An example item. +-- An item you can create a copy of as a starting point. This is the minimum needed for an item. Different inventories usually also require different fields and functions. +--@classmod npctbl + +local npc = {} + +---Stats for movement and health +npc.Stats = { + ["Vitality"] = 100, --Hitpoints + ["Accel"] = 25, --How quickly the monster can get up to speed? + ["Decel"] = 25, --How quickly the monster can stop? + ["Step"] = 8, --How high a stair can this monster climb? + ["Speed"] = 250 --How fast can this monster go? +} +--More navigation settings +npc.goaltolarance = 5 +npc.lookahead = 3 + +---Things that npc's drop. +-- Should be an array of tuples ("item name", %chance drop). +-- If you want more than 1 of an item to drop, you should have multiples items +-- +-- -- This NPC will always drop 1 Monster Meat, and has a 50% chance of dropping +-- -- 2 Monster Meat. +-- npc.Drops = { +-- {"Monster Meat", 100}, +-- {"Monster Meat", 50} +-- } +npc.Drops = { +} + +---Do special things on spawn. +-- If This monster needs to do anything special on spawn (for example, +-- a boss monster might trap players in the area untill it's defeated) +-- @optional +-- @tparam entity The monster that's spawning. +-- @treturn void +function npc.OnSpawn(ent) + +end + +---Do special things when damaged. +-- If this monster needs to do anything special when it gets dammaged +-- @optional +-- @tparam entity The monster that's being damaged +-- @tparam dmg The damange table +-- @treturn void +function npc.OnDammage(ent,dmg) + +end + diff --git a/gamemode/nrequire.lua b/gamemode/nrequire.lua index 3fbe9d7..d704907 100644 --- a/gamemode/nrequire.lua +++ b/gamemode/nrequire.lua @@ -139,6 +139,10 @@ function nrequire(req,...) --Actually run the file pathstack[#pathstack + 1] = tpath[1] local filetxt = file.Read(tpath[1],tpath[2]) + if #filetxt == 0 then + pathstack[#pathstack] = nil + return + end local filetime = file.Time(tpath[1],tpath[2]) local filefunc = CompileString(filetxt,tpath[1],false) if type(filefunc) ~= "function" then |
