Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
5b04f40
Area timer optimizations
zoephix Feb 16, 2021
4a28c58
Update database configuration loading (again) (#21)
zoephix Feb 17, 2021
ac68492
Create database.example
zoephix Feb 17, 2021
c2da573
Added persistence plugin (#23)
zoephix Feb 17, 2021
8767578
snip
zoephix Feb 17, 2021
f863518
1.2 wip (#24)
zoephix Feb 17, 2021
7e48bb8
snip
zoephix Feb 17, 2021
a8b9a74
Fixed devName error
zoephix Feb 17, 2021
3fe5eba
Author name fetching via Steam ID (#27)
zoephix Feb 17, 2021
3f5a36e
Fixed admin delay
zoephix Feb 28, 2021
84db2da
Fixed admin chat delay
zoephix Feb 28, 2021
ddc3f66
Added chat icons
zoephix Feb 28, 2021
6c65114
Return the disconnected player's Steam ID
zoephix Mar 3, 2021
edc8445
Lua consistency
zoephix Mar 3, 2021
9386baf
Whitespaces + Deprecated Cleanup
raecyst Mar 4, 2021
c64e719
Key fix for 1.2-wip
raecyst Mar 4, 2021
bcb381a
Optimizations
zoephix Mar 4, 2021
cf3ddaa
Merge pull request #32 from SeamusMcGowan/1.2-wip
TovarischPootis Mar 6, 2021
c0d12cb
Added hook for chat text add
zoephix Mar 8, 2021
967c042
Added chat timestamps (#34)
zoephix Mar 8, 2021
de88a73
Added chat size difference plugin
zoephix Mar 8, 2021
da3202d
Update chatsizediff.lua
zoephix Mar 8, 2021
d2f4c12
Update chatsizediff.lua
zoephix Mar 8, 2021
5b171f1
tweaked font sizes
zoephix Mar 8, 2021
4532414
Support added for actions
zoephix Mar 8, 2021
cb68ea3
Fixed invalid chat mode returning nil
zoephix Mar 8, 2021
b4f087f
Increased font weight
zoephix Mar 8, 2021
01a7b12
1.2 wip Date/Time. != vs ~=, small fix when spawning bots (#33)
TovarischPootis Mar 14, 2021
217599e
Added Hook
raecyst Mar 20, 2021
198ce0c
Update chatsizediff.lua
zoephix Mar 20, 2021
31769a3
Update cl_plugin.lua
zoephix Mar 20, 2021
4187b71
Fix Item Descs
TovarischPootis Mar 20, 2021
365c8aa
Deprication/whitespaces/consistency
TovarischPootis Mar 20, 2021
714ff75
Ability to use @ and ^ when a chat command needs a character's name i…
TovarischPootis Mar 20, 2021
c8dcbd5
Updated Russian localization
TovarischPootis Mar 20, 2021
4273847
Merge pull request #36 from Zoephix/1.2-wip
TovarischPootis Mar 20, 2021
9864a50
Merge pull request #39 from SeamusMcGowan/1.2-wip
TovarischPootis Mar 20, 2021
f5d03c7
1.2 wip (#40)
TovarischPootis Mar 20, 2021
91f685f
Return default text
zoephix Mar 21, 2021
c98e7f9
Alteration to salary
raecyst Mar 29, 2021
54589ad
Fixed class commit
raecyst Mar 29, 2021
6c6d297
Another quick fix
raecyst Mar 29, 2021
e2ddc9c
Update gamemode/core/hooks/sv_hooks.lua
raecyst Mar 29, 2021
dd44cd0
Update gamemode/core/hooks/sv_hooks.lua
raecyst Mar 29, 2021
c0dcc47
Update gamemode/core/hooks/sv_hooks.lua
raecyst Mar 29, 2021
5345385
Hook to hide players in Scoreboard
raecyst Mar 31, 2021
d15e50a
Merge branch '1.2-wip' of https://github.com/SeamusMcGowan/NutScript-…
raecyst Mar 31, 2021
cf3733d
Optimization
raecyst Mar 31, 2021
844532b
Update cl_scoreboard.lua
raecyst Mar 31, 2021
1b24b74
Update sv_hooks.lua
zoephix Mar 31, 2021
03c8139
Update cl_scoreboard.lua
zoephix Mar 31, 2021
e92ca59
Remade Credits. Added surfaceGetURL. Added comments to ease to explai…
TovarischPootis Apr 1, 2021
b4bda2e
Merge remote-tracking branch 'upstream/1.2-wip' into 1.2-wip
TovarischPootis Apr 1, 2021
3da6614
Update cl_helps.lua
TovarischPootis Apr 1, 2021
84f2809
Update nscredits.lua
TovarischPootis Apr 1, 2021
5787df0
Fixed the autoname for plugin/schema authors
TovarischPootis Apr 1, 2021
2b0b60b
Made the logo of the ns logo in credits pulse a little
TovarischPootis Apr 1, 2021
ccdff98
Update plugins/scoreboard/derma/cl_scoreboard.lua
raecyst Apr 1, 2021
64f8647
Lead/Head, added discord invite button
TovarischPootis Apr 1, 2021
0846cf9
Update plugins/scoreboard/derma/cl_scoreboard.lua
raecyst Apr 2, 2021
27da3fc
Merge pull request #42 from SeamusMcGowan/1.2-wip
TovarischPootis Apr 2, 2021
639e0ce
Remade Credits. Added surfaceGetURL. Added comments to ease to explai…
TovarischPootis Apr 2, 2021
34b6e9b
Resolve conflict because the commit was done to the 1.2 branch, not 1…
TovarischPootis Apr 2, 2021
e6bf8e3
Merge branch 'heads/1.2' into 1.2-wip
TovarischPootis Apr 2, 2021
c673606
1.2 wip (#46)
TovarischPootis Apr 2, 2021
bccdcc9
Spurion's bugfix
TovarischPootis Apr 2, 2021
3eab2ef
item instances fix
TovarischPootis Apr 5, 2021
67bd6f2
Merge branch '1.2-wip' of https://github.com/TovarischPootis/NutScrip…
TovarischPootis Apr 5, 2021
ee5f472
Update sv_hooks.lua
TovarischPootis Apr 5, 2021
1bdd7b3
watch your profanity
TovarischPootis Apr 5, 2021
3375df9
Merge branch '1.2' into 1.2-wip
TovarischPootis Apr 5, 2021
247c62f
nut.item.instances fix that broke items (#1)
TovarischPootis Apr 5, 2021
5504e43
Sync items that are not in the world to newly connected players, in o…
TovarischPootis Apr 5, 2021
b97b6af
Sync items that are not in the world to newly connected players, in o…
TovarischPootis Apr 5, 2021
79ef8dd
slight networking optimization
TovarischPootis Apr 5, 2021
8308ea7
Merge branch '1.2' into 1.2-wip
TovarischPootis Apr 5, 2021
3eb5778
Merge pull request #3 from TovarischPootis/1.2-wip
TovarischPootis Apr 5, 2021
d3bb0cb
Update nut_item.lua
TovarischPootis Apr 5, 2021
27f1ca7
Merge pull request #4 from TovarischPootis/1.2-wip
TovarischPootis Apr 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions entities/entities/nut_item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ if (SERVER) then
local itemTable = nut.item.instances[itemID]
if (not itemTable) then return self:Remove() end

itemTable:sync() -- sync it with the clients to be able to properly interact with the item

local model = itemTable.onGetDropModel
and itemTable:onGetDropModel(self)
or itemTable.model
Expand All @@ -57,7 +59,7 @@ if (SERVER) then
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:setNetVar("id", itemTable.uniqueID)
self:setNetVar("instanceID", itemTable:getID())
self:setNetVar("instanceID", itemTable.id)
self.nutItemID = itemID

if (table.Count(itemTable.data) > 0) then
Expand Down Expand Up @@ -142,7 +144,6 @@ else
function ENT:onDrawEntityInfo(alpha)
local itemTable = self:getItemTable()
if (not itemTable) then return end

local oldEntity = itemTable.entity
itemTable.entity = self

Expand Down Expand Up @@ -193,7 +194,8 @@ else
end

function ENT:getItemID()
return self:getNetVar("instanceID", "")
return self:getNetVar("instanceID")

end

function ENT:getItemTable()
Expand Down
87 changes: 45 additions & 42 deletions gamemode/core/hooks/sv_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function GM:PlayerInitialSpawn(client)

-- Load and send the NutScript data for the player.
client:loadNutData(function(data)
if (!IsValid(client)) then return end
if (not IsValid(client)) then return end

local address = client:IPAddress()
client:setNutData("lastIP", address)
Expand All @@ -53,6 +53,13 @@ function GM:PlayerInitialSpawn(client)
"nutDataSync",
data, client.firstJoin, client.lastJoin
)

for _, v in pairs(nut.item.instances) do
if v.entity and v.invID == 0 then
v:sync(client)
end
end

hook.Run("PlayerNutDataLoaded", client)
end)

Expand All @@ -71,7 +78,7 @@ function GM:PlayerUse(client, entity)
if (result == false) then
return false
else
local result = hook.Run("PlayerUseDoor", client, entity)
result = hook.Run("PlayerUseDoor", client, entity)
if (result ~= nil) then
return result
end
Expand Down Expand Up @@ -107,12 +114,12 @@ function GM:CanPlayerDropItem(client, item)

if (inventory) then
local items = inventory:getItems()
for _, item in pairs(items) do

for id, item in pairs(items) do
if (not item.ignoreEquipCheck and item:getData("equip") == true) then
client:notifyLocalized("cantDropBagHasEquipped")
return false
end
end
end
end
end
Expand Down Expand Up @@ -192,23 +199,20 @@ function GM:PlayerLoadedChar(client, character, lastChar)
if (lastChar) then
local charEnts = lastChar:getVar("charEnts") or {}

for k, v in ipairs(charEnts) do
for _, v in ipairs(charEnts) do
if (v and IsValid(v)) then
v:Remove()
end
end

lastChar:setVar("charEnts", nil)
lastChar:setVar("charEnts", nil)
end

if (character) then
for k, v in pairs(nut.class.list) do
if (v.faction == client:Team()) then
if (v.isDefault) then
character:setClass(v.index)

break
end
for _, v in pairs(nut.class.list) do
if (v.faction == client:Team()) and v.isDefault then
character:setClass(v.index)
break
end
end
end
Expand Down Expand Up @@ -246,10 +250,8 @@ end
function GM:PlayerSay(client, message)
local chatType, message, anonymous = nut.chat.parse(client, message, true)

if (chatType == "ic") then
if (nut.command.parse(client, message)) then
return ""
end
if (chatType == "ic") and (nut.command.parse(client, message)) then
return ""
end

nut.chat.send(client, chatType, message, anonymous)
Expand Down Expand Up @@ -309,7 +311,7 @@ function GM:PlayerSpawnVehicle(client, model, name, data)
return client:getChar():hasFlags("C")
end
end

return false
end

Expand All @@ -320,7 +322,7 @@ function GM:PlayerLoadout(client)

return
end

client:SetWeaponColor(Vector(client:GetInfo("cl_weaponcolor")))
client:StripWeapons()
client:setLocalVar("blur", nil)
Expand All @@ -335,7 +337,7 @@ function GM:PlayerLoadout(client)
client:Give("nut_hands")
client:SetWalkSpeed(nut.config.get("walkSpeed", 130))
client:SetRunSpeed(nut.config.get("runSpeed", 235))

local faction = nut.faction.indices[client:Team()]

if (faction) then
Expand All @@ -346,7 +348,7 @@ function GM:PlayerLoadout(client)

-- If the faction has default weapons, give them to the player.
if (faction.weapons) then
for k, v in ipairs(faction.weapons) do
for _, v in ipairs(faction.weapons) do
client:Give(v)
end
end
Expand All @@ -361,7 +363,7 @@ function GM:PlayerLoadout(client)
end

if (class.weapons) then
for k, v in ipairs(class.weapons) do
for _, v in ipairs(class.weapons) do
client:Give(v)
end
end
Expand Down Expand Up @@ -439,7 +441,7 @@ function GM:PlayerDisconnected(client)
if (character) then
local charEnts = character:getVar("charEnts") or {}

for k, v in ipairs(charEnts) do
for _, v in ipairs(charEnts) do
if (v and IsValid(v)) then
v:Remove()
end
Expand All @@ -450,7 +452,7 @@ function GM:PlayerDisconnected(client)
hook.Run("OnCharDisconnect", client, character)
character:save()
end

if (IsValid(client.nutRagdoll)) then
client.nutRagdoll.nutNoReset = true
client.nutRagdoll.nutIgnoreDelete = true
Expand All @@ -463,18 +465,18 @@ end
function GM:PlayerAuthed(client, steamID, uniqueID)
nut.log.add(client, "playerConnected", client, steamID)
end

function GM:InitPostEntity()
local doors = ents.FindByClass("prop_door_rotating")

for k, v in ipairs(doors) do
for _, v in ipairs(doors) do
local parent = v:GetOwner()

if (IsValid(parent)) then
v.nutPartner = parent
parent.nutPartner = v
else
for k2, v2 in ipairs(doors) do
for _, v2 in ipairs(doors) do
if (v2:GetOwner() == v) then
v2.nutPartner = v
v.nutPartner = v2
Expand Down Expand Up @@ -505,7 +507,7 @@ function GM:ShutDown()

hook.Run("SaveData")

for k, v in ipairs(player.GetAll()) do
for _, v in ipairs(player.GetAll()) do
v:saveNutData()

if (v:getChar()) then
Expand All @@ -519,7 +521,7 @@ function GM:PlayerDeathSound()
end

function GM:InitializedSchema()
if (!nut.data.get("date", nil, false, true)) then
if (not nut.data.get("date", nil, false, true)) then
nut.data.set("date", os.time(), false, true)
end

Expand All @@ -534,21 +536,21 @@ end

function GM:PlayerCanHearPlayersVoice(listener, speaker)
local allowVoice = nut.config.get("allowVoice")
if (!allowVoice) then

if (not allowVoice) then
return false, false
end

if (listener:GetPos():DistToSqr(speaker:GetPos()) > nut.config.squaredVoiceDistance) then
return false, false
end

return true, true
end

function GM:OnPhysgunFreeze(weapon, physObj, entity, client)
-- Object is already frozen (!?)
if (!physObj:IsMoveable()) then return false end
if (not physObj:IsMoveable()) then return false end
if (entity:GetUnFreezable()) then return false end

physObj:EnableMotion(false)
Expand Down Expand Up @@ -598,15 +600,16 @@ function GM:CharacterPreSave(character)
if (not character:getInv()) then
return
end
for k, v in pairs(character:getInv():getItems()) do
for _, v in pairs(character:getInv():getItems()) do
if (v.onSave) then
v:call("onSave", client)
end
end
end

function GM:OnServerLog(client, logType, ...)
for k, v in pairs(nut.util.getAdmins()) do
for _, v in pairs(nut.util.getAdmins()) do

if (hook.Run("CanPlayerSeeLog", v, logType) ~= false) then
nut.log.send(v, nut.log.getString(client, logType, ...))
end
Expand Down Expand Up @@ -650,14 +653,14 @@ PUBLIC SERVICE ANNOUNCEMENT FOR NUTSCRIPT SERVER OWNERS

There is a ENOURMOUS performance issue with ULX Admin mod.
Nutscript Development Team found ULX is the main issue
that make the server freeze when player count is higher
that make the server freeze when player count is higher
than 20-30. The duration of freeze will be increased as you get
more players on your server.

If you're planning to open big server with ULX/ULib, Nutscript
Development Team does not recommend your plan. Server Performance
Issues with ULX/Ulib on your server will be ignored and we're
going to consider that you're taking the risk of ULX/Ulib's
Issues with ULX/Ulib on your server will be ignored and we're
going to consider that you're taking the risk of ULX/Ulib's
critical performance issue.

Nutscript 1.2 only displays this message when you have ULX or
Expand Down Expand Up @@ -723,10 +726,10 @@ function GM:CreateSalaryTimer(client)

local faction = nut.faction.indices[character:getFaction()]
local class = nut.class.list[character:getClass()]

local pay = hook.Run("GetSalaryAmount", client, faction, class) or (class and class.pay) or (faction and faction.pay) or nil
if (!pay) then return end

if (not pay) then return end

local timerID = "nutSalary"..client:SteamID()
local timerFunc = timer.Exists(timerID) and timer.Adjust or timer.Create
Expand Down
4 changes: 2 additions & 2 deletions gamemode/core/libs/item/sv_item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function nut.item.instance(index, uniqueID, itemData, x, y, callback)

if (MYSQLOO_PREPARED and isnumber(index)) then
nut.db.preparedCall(
"itemInstance", onItemCreated, index, uniqueID, itemData, x, y, itemTable.maxQuantity or 1
"itemInstance", onItemCreated, index, uniqueID, itemData, x, y, itemTable.maxQuantity or 1
)
else
nut.db.insertTable({
Expand All @@ -67,7 +67,7 @@ function nut.item.instance(index, uniqueID, itemData, x, y, callback)
_data = itemData,
_x = x,
_y = y,
_quantity = itemTable.maxQuantity or 1
_quantity = itemTable.maxQuantity or 1
}, onItemCreated, "items")
end

Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/libs/item/sv_networking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ util.AddNetworkString("nutItemInstance")

netstream.Hook("invAct", function(client, action, item, invID, data)
local character = client:getChar()
if (!character) then
if (not character) then
return
end

Expand Down
1 change: 1 addition & 0 deletions gamemode/core/libs/sh_item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function nut.item.loadFromDir(directory)
end

function nut.item.new(uniqueID, id)

id = id and tonumber(id) or id
assert(isnumber(id), "non-number ID given to nut.item.new")

Expand Down
6 changes: 3 additions & 3 deletions plugins/logging.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PLUGIN.author = "Black Tea"
PLUGIN.desc = "You can modfiy the logging text/lists on this plugin."

if (SERVER) then
local L, type, IsValid = Format, type, IsValid
local L, IsValid = Format, IsValid

nut.log.addType("playerHurt", function(client, attacker, damage, health)
attacker = tostring(attacker)
Expand Down Expand Up @@ -104,7 +104,7 @@ if (SERVER) then
local arg = {...}
return (L("%s purchased the door", client:Name()))
end)

nut.log.addType("observerEnter", function(client, ...)
return string.format("%s has entered observer.", client:Name())
end)
Expand All @@ -126,7 +126,7 @@ if (SERVER) then
function PLUGIN:OnCharCreated(client, character)
nut.log.add(client, "charCreate", character)
end

function PLUGIN:OnTakeShipmentItem(client, itemClass, amount)
local itemTable = nut.item.list[itemClass]
nut.log.add(client, "shipment", itemTable.name)
Expand Down