Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
7bca867
Add persistence plugin
zoephix Feb 14, 2021
2d1c281
lua consistency
TovarischPootis Feb 14, 2021
10a1caf
Removed restrictions plugin alliances
zoephix Feb 14, 2021
b85c570
Update sv_database.lua
zoephix Feb 14, 2021
807d3b1
Merge pull request #7 from TovarischPootis/1.2-wip
zoephix Feb 14, 2021
a800cec
Merge pull request #1 from NutScript/1.2
TovarischPootis Feb 14, 2021
f774059
Merge pull request #2 from NutScript/1.2-wip
TovarischPootis Feb 14, 2021
6b8d706
Merge pull request #3 from NutScript/1.2-wip
zoephix Feb 14, 2021
026bb68
Merge pull request #5 from Zoephix/1.2-wip
zoephix Feb 14, 2021
cbf0c42
whitespace
TovarischPootis Feb 14, 2021
55b7f54
Merge pull request #9 from TovarischPootis/1.2-wip
TovarischPootis Feb 14, 2021
e1df0db
Merge pull request #4 from NutScript/1.2-wip
zoephix Feb 14, 2021
57cc63e
Update sh_plugin.lua
zoephix Feb 14, 2021
944229f
Merge pull request #10 from Zoephix/1.2-wip
zoephix Feb 14, 2021
c89281d
Revert "Merge pull request #10 from Zoephix/1.2-wip"
zoephix Feb 14, 2021
af829eb
Revert "Update sh_plugin.lua"
zoephix Feb 14, 2021
d038366
Merge pull request #11 from Zoephix/1.2-wip
zoephix Feb 14, 2021
d1856ec
yet another date modification, this time, lightweight
TovarischPootis Feb 14, 2021
e19701e
Removed already defined starting time
zoephix Feb 14, 2021
aeec8d8
Merge pull request #13 from TovarischPootis/1.2-wip
zoephix Feb 14, 2021
6ac649a
Update database configuration loading
zoephix Feb 14, 2021
49d3d0d
Added date migrations
zoephix Feb 14, 2021
37586c4
Added date migrations
zoephix Feb 14, 2021
5855737
Update chatbox icons
zoephix Feb 14, 2021
cd7616b
As suggested, timer runs only on day change rather than every 5 minutes
TovarischPootis Feb 15, 2021
5351bda
Merge pull request #16 from Zoephix/patch-1
TovarischPootis Feb 15, 2021
4a18b06
Merge pull request #17 from Zoephix/patch-2
TovarischPootis Feb 15, 2021
febb183
Merge branch '1.2-wip' into 1.2-wip
TovarischPootis Feb 15, 2021
6c139fc
Merge pull request #15 from Zoephix/1.2-wip
zoephix Feb 15, 2021
2524180
Merge pull request #18 from TovarischPootis/1.2-wip
zoephix Feb 15, 2021
3c92847
Update README.md
zoephix Feb 15, 2021
d832075
Merge pull request #19 from TovarischPootis/1.2-wip
TovarischPootis Feb 15, 2021
df1e5ef
doesnt exist anymore
TovarischPootis Feb 15, 2021
da8b291
Added more valid config locations
zoephix Feb 15, 2021
29f85c3
Update config loading
zoephix Feb 15, 2021
3e6cb1a
Update config loading
zoephix Feb 15, 2021
77a48ad
Update config loading
zoephix Feb 15, 2021
41a59bd
Added example database configuration
zoephix Feb 15, 2021
5c61d40
Added credits tab
zoephix Feb 15, 2021
ee6f985
Added hover sound
zoephix Feb 15, 2021
4831d01
whitespace
TovarischPootis Feb 15, 2021
bf1a047
Credits tab (WIP)
zoephix Feb 15, 2021
a219d52
Added contributors to the credits
zoephix Feb 15, 2021
2ddf7d5
Increased spacing, extra polishing
zoephix Feb 15, 2021
b18ff54
Increased font size
zoephix Feb 15, 2021
90ddda8
Merge remote-tracking branch 'upstream/1.2-wip' into 1.2-wip
TovarischPootis Feb 15, 2021
233479f
Merge branch '1.2-wip-tovtemp' into 1.2-wip
TovarischPootis Feb 17, 2021
16e70e3
Ability for Plugin/Schema creators to set their SteamIDs for dynamic …
TovarischPootis Feb 17, 2021
0edb8a4
Merge remote-tracking branch 'upstream/1.2-wip' into 1.2-wip
TovarischPootis Feb 17, 2021
2bfc101
Update sh_plugin.lua
TovarischPootis Feb 17, 2021
afdad86
!= ~=
TovarischPootis Mar 2, 2021
9325753
Merge remote-tracking branch 'upstream/1.2-wip' into 1.2-wip
TovarischPootis Mar 2, 2021
ea22838
update date
TovarischPootis Mar 4, 2021
ea710b5
1.2 wip (#3)
TovarischPootis Mar 6, 2021
2c39647
1.2 wip (#4)
TovarischPootis Mar 6, 2021
9950403
Merge branch '1.2-wip' of https://github.com/TovarischPootis/NutScrip…
TovarischPootis Mar 6, 2021
80b68d0
yes
TovarischPootis Mar 6, 2021
89e0c0d
Merge branch '1.2-wip' of https://github.com/TovarischPootis/NutScrip…
TovarischPootis Mar 6, 2021
a94c1eb
hilarious
TovarischPootis Mar 6, 2021
400d2ea
small tweak with the NS intro
TovarischPootis Mar 9, 2021
b4528bb
Merge remote-tracking branch 'upstream/1.2-wip' into 1.2-wip
TovarischPootis Mar 9, 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
62 changes: 30 additions & 32 deletions entities/weapons/nut_hands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ local CurTime = CurTime


local function SetSubPhysMotionEnabled(entity, enable)
if (!IsValid(entity)) then
if (not IsValid(entity)) then
return
end

Expand Down Expand Up @@ -183,8 +183,8 @@ function SWEP:reset(throw)
if (IsValid(self.holdingEntity)) then
local owner = self:GetOwner()

if (!self.holdingEntity:IsWeapon()) then
if (!IsValid(self.prevOwner)) then
if (not self.holdingEntity:IsWeapon()) then
if (not IsValid(self.prevOwner)) then
self.holdingEntity:SetOwner(nil)
else
self.holdingEntity:SetOwner(self.prevOwner)
Expand All @@ -201,7 +201,7 @@ function SWEP:reset(throw)
phys:EnableMotion(true)
end

if (!throw) then
if (not throw) then
removeVelocity(self.holdingEntity)
else
throwVelocity(self.holdingEntity, owner, 300)
Expand All @@ -219,8 +219,8 @@ function SWEP:reset(throw)
end

function SWEP:drop(throw)
if (!self:checkValidity()) then return end
if (!self:allowEntityDrop()) then return end
if (not self:checkValidity()) then return end
if (not self:allowEntityDrop()) then return end

if (SERVER) then
self.constr:Remove()
Expand Down Expand Up @@ -253,7 +253,7 @@ function SWEP:drop(throw)
end

function SWEP:checkValidity()
if (!IsValid(self.holdingEntity)) or (!IsValid(self.carryHack)) or (!IsValid(self.constr)) then
if (not IsValid(self.holdingEntity)) or (not IsValid(self.carryHack)) or (not IsValid(self.constr)) then
-- if one of them is not valid but another is non-nil...
if (self.holdingEntity or self.carryHack or self.constr) then
self:reset()
Expand Down Expand Up @@ -281,7 +281,7 @@ if (SERVER) then

local stand_time = 0
function SWEP:Think()
if (!self:checkValidity()) then
if (not self:checkValidity()) then
return
end

Expand Down Expand Up @@ -322,7 +322,7 @@ if (SERVER) then
end
else
function SWEP:Think()
local owner = self:GetOwner()
local owner = self:GetOwner()

if (CLIENT and owner) then
local viewModel = owner:GetViewModel()
Expand All @@ -335,14 +335,14 @@ else
end

function SWEP:PrimaryAttack()
if (!IsFirstTimePredicted()) then
if (not IsFirstTimePredicted()) then
return
end

local owner = self:GetOwner()

if (IsValid(self.holdingEntity)) then
self:doPickup(!self.isWepRaised or owner:isWepRaised())
self:doPickup(not self.isWepRaised or owner:isWepRaised())
return
end

Expand Down Expand Up @@ -379,7 +379,7 @@ end

local hull = Vector(4, 4, 4)
function SWEP:SecondaryAttack()
if (!IsFirstTimePredicted()) then
if (not IsFirstTimePredicted()) then
return
end

Expand Down Expand Up @@ -407,9 +407,9 @@ function SWEP:SecondaryAttack()
self:doPunchAnimation()
self:SetNextSecondaryFire(CurTime() + 0.4)
self:SetNextPrimaryFire(CurTime() + 1)
elseif (!entity:IsPlayer() and !entity:IsNPC()) then
elseif (not entity:IsPlayer() and not entity:IsNPC()) then
self:doPickup(false, entity, trace)
elseif (IsValid(self.heldEntity) and !self.heldEntity:IsPlayerHolding()) then
elseif (IsValid(self.heldEntity) and not self.heldEntity:IsPlayerHolding()) then
self.heldEntity = nil
end
else
Expand All @@ -419,8 +419,8 @@ function SWEP:SecondaryAttack()
end
end

function SWEP:dragObject(phys, targetpos, is_ragdoll)
if (!IsValid(phys)) then
function SWEP:dragObject(phys, targetpos)
if (not IsValid(phys)) then
return
end

Expand All @@ -431,8 +431,6 @@ function SWEP:dragObject(phys, targetpos, is_ragdoll)
local length = physDirection:Length2D()
physDirection:Normalize()

local mass = phys:GetMass()

phys:SetVelocity(physDirection * math.min(length, 250))
end

Expand All @@ -451,12 +449,12 @@ function SWEP:allowPickup(target)

return
IsValid(phys) and IsValid(client) and client:getChar() and
(!phys:HasGameFlag(FVPHYSICS_NO_PLAYER_PICKUP)) and
(not phys:HasGameFlag(FVPHYSICS_NO_PLAYER_PICKUP)) and
phys:GetMass() <= CARRY_WEIGHT_LIMIT and
(!isPlayerStandsOn(target)) and
(target.CanPickup != false) and
hook.Run("GravGunPickupAllowed", client, target) != false and
(target.GravGunPickupAllowed and (target:GravGunPickupAllowed(client) != false) or true)
(not isPlayerStandsOn(target)) and
(target.CanPickup ~= false) and
hook.Run("GravGunPickupAllowed", client, target) ~= false and
(target.GravGunPickupAllowed and (target:GravGunPickupAllowed(client) ~= false) or true)
end

function SWEP:doPickup(throw, entity, trace)
Expand All @@ -474,7 +472,7 @@ function SWEP:doPickup(throw, entity, trace)
if (IsValid(entity)) then
local phys = entity:GetPhysicsObject()

if (!IsValid(phys) or !phys:IsMoveable() or phys:HasGameFlag(FVPHYSICS_PLAYER_HELD)) then
if (not IsValid(phys) or not phys:IsMoveable() or phys:HasGameFlag(FVPHYSICS_PLAYER_HELD)) then
hook.Run("OnPickupObject", false, client, entity)
return
end
Expand All @@ -492,7 +490,7 @@ function SWEP:doPickup(throw, entity, trace)
self:SetNextSecondaryFire(CurTime() + delay)
return
else
local is_ragdoll = entity:GetClass() == "prop_ragdoll"
--local is_ragdoll = entity:GetClass() == "prop_ragdoll"

--[[
--Drag ragdoll/props
Expand Down Expand Up @@ -552,7 +550,7 @@ function SWEP:pickup(entity, trace)
-- TODO: set the desired angles before adding the constraint
local preferredAngles = hook.Run("GetPreferredCarryAngles", self.holdingEntity)

if (client:KeyDown(IN_RELOAD) and !preferredAngles) then
if (client:KeyDown(IN_RELOAD) and not preferredAngles) then
preferredAngles = Angle()
end

Expand All @@ -572,7 +570,7 @@ function SWEP:pickup(entity, trace)

self.carryHack:Spawn()

if (!self.holdingEntity:IsWeapon()) then
if (not self.holdingEntity:IsWeapon()) then
self.prevOwner = self.holdingEntity:GetOwner()

self.holdingEntity:SetOwner(client)
Expand Down Expand Up @@ -614,7 +612,7 @@ local down = Vector(0, 0, -1)
function SWEP:allowEntityDrop()
local client = self:GetOwner()

if (!IsValid(client)) or (!IsValid(self.carryHack)) then return false end
if (not IsValid(client)) or (not IsValid(self.carryHack)) then return false end

local ground = client:GetGroundEntity()
if ground and (ground:IsWorld() or IsValid(ground)) then return true end
Expand Down Expand Up @@ -648,8 +646,8 @@ ACT_VM_FISTS_HOLSTER = 2

function SWEP:Deploy()
local owner = self:GetOwner()
if (!IsValid(owner)) then

if (not IsValid(owner)) then
return
end

Expand All @@ -668,7 +666,7 @@ end
function SWEP:Holster()
local owner = self:GetOwner()

if (!IsValid(owner)) then
if (not IsValid(owner)) then
return
end

Expand Down Expand Up @@ -721,7 +719,7 @@ function SWEP:doPunch()
local context = {damage = damage}
local result = hook.Run("PlayerGetFistDamage", owner, damage, context)

if (result != nil) then
if (result ~= nil) then
damage = result
else
damage = context.damage
Expand Down
10 changes: 5 additions & 5 deletions gamemode/core/derma/cl_inventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function PANEL:openActionMenu()
end
end

if (send != false) then
if (send ~= false) then
netstream.Start("invAct", k, itemTable.id, self.invID)
end
itemTable.player = nil
Expand Down Expand Up @@ -190,7 +190,7 @@ function PANEL:openActionMenu()
end
end

if (send != false) then
if (send ~= false) then
netstream.Start(
"invAct",
k,
Expand Down Expand Up @@ -221,7 +221,7 @@ function PANEL:openActionMenu()
end
end

if (send != false) then
if (send ~= false) then
netstream.Start("invAct", k, itemTable.id, self.invID)
end
itemTable.player = nil
Expand Down Expand Up @@ -287,7 +287,7 @@ vgui.Register("nutInventory", PANEL, "DFrame")

local margin = 10
hook.Add("CreateMenuButtons", "nutInventory", function(tabs)
if (hook.Run("CanPlayerViewInventory") != false) then
if (hook.Run("CanPlayerViewInventory") ~= false) then
tabs["inv"] = function(panel)
local inventory = LocalPlayer():getChar():getInv()

Expand All @@ -302,7 +302,7 @@ hook.Add("CreateMenuButtons", "nutInventory", function(tabs)
totalSize.y = math.max(totalSize.y, mainPanel:GetTall())

for id, item in pairs(inventory:getItems()) do
if (item.isBag and hook.Run("CanOpenBagPanel", item) != false) then
if (item.isBag and hook.Run("CanOpenBagPanel", item) ~= false) then
local inventory = item:getInv()

local childPanels = inventory:show(mainPanel)
Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/derma/cl_modelpanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local PANEL = {}
local found = false

for k, v in ipairs(entity:GetSequenceList()) do
if ((v:lower():find("idle") or v:lower():find("fly")) and v != "idlenoise") then
if ((v:lower():find("idle") or v:lower():find("fly")) and v ~= "idlenoise") then
entity:ResetSequence(v)
found = true

Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/derma/cl_spawnicon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local PANEL = {}
local found = false

for k, v in ipairs(entity:GetSequenceList()) do
if ((v:lower():find("idle") or v:lower():find("fly")) and v != "idlenoise") then
if ((v:lower():find("idle") or v:lower():find("fly")) and v ~= "idlenoise") then
entity:ResetSequence(v)
found = true

Expand Down
7 changes: 4 additions & 3 deletions gamemode/core/hooks/cl_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ function GM:InitializedConfig()
end

function GM:CharacterListLoaded()
local shouldPlayIntro = not nut.config.get("playIntroOnlyOnce", true) or not nut.localData.intro or nil
local shouldPlayIntro = nut.config.get("alwaysPlayIntro", true) or not nut.localData.intro or nil
print("shouldPlayIntro", shouldPlayIntro)
timer.Create("nutWaitUntilPlayerValid", 0.5, 0, function()
if (not IsValid(LocalPlayer())) then return end
timer.Remove("nutWaitUntilPlayerValid")
Expand All @@ -294,7 +295,7 @@ function GM:CharacterListLoaded()
if (IsValid(nut.gui.loading)) then
nut.gui.loading:Remove()
end

RunConsoleCommand("stopsound")
-- Show the intro if needed, then show the character menu.
local intro =
shouldPlayIntro and hook.Run("CreateIntroduction") or nil
Expand Down Expand Up @@ -462,7 +463,7 @@ function GM:ItemShowEntityMenu(entity)
surface.PlaySound(v.sound)
end

if (send != false) then
if (send ~= false) then
callback(k)
end
end
Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/hooks/sh_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,6 @@ function GM:CanItemBeTransfered(itemObject, curInv, inventory)
if (itemObject.onCanBeTransfered) then
local itemHook = itemObject:onCanBeTransfered(curInv, inventory)

return (itemHook != false)
return (itemHook ~= false)
end
end
6 changes: 3 additions & 3 deletions gamemode/core/hooks/sv_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function GM:CanPlayerDropItem(client, item)

if (inventory) then
local items = inventory:getItems()

for id, item in pairs(items) do
if (not item.ignoreEquipCheck and item:getData("equip") == true) then
client:notifyLocalized("cantDropBagHasEquipped")
Expand Down Expand Up @@ -158,7 +158,7 @@ function GM:CanPlayerTakeItem(client, item)
end

function GM:PlayerShouldTakeDamage(client, attacker)
return client:getChar() != nil
return client:getChar() ~= nil
end

function GM:EntityTakeDamage(entity, dmgInfo)
Expand Down Expand Up @@ -607,7 +607,7 @@ end

function GM:OnServerLog(client, logType, ...)
for k, v in pairs(nut.util.getAdmins()) do
if (hook.Run("CanPlayerSeeLog", v, logType) != false) then
if (hook.Run("CanPlayerSeeLog", v, logType) ~= false) then
nut.log.send(v, nut.log.getString(client, logType, ...))
end
end
Expand Down
4 changes: 2 additions & 2 deletions gamemode/core/libs/cl_networking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ end)
function getNetVar(key, default)
local value = nut.net.globals[key]

return value != nil and value or default
return value ~= nil and value or default
end

function entityMeta:getNetVar(key, default)
local index = self:EntIndex()

if (nut.net[index] and nut.net[index][key] != nil) then
if (nut.net[index] and nut.net[index][key] ~= nil) then
return nut.net[index][key]
end

Expand Down
10 changes: 5 additions & 5 deletions gamemode/core/libs/sh_character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if (SERVER) then
netstream.Hook("nutCharFetchNames", function(client)
netstream.Start(client, "nutCharFetchNames", nut.char.names)
end)

-- Removes name from table upon character deletion
hook.Add("nutCharDeleted", "nutCharRemoveName", function(client, character)
nut.char.names[character:getID()] = nil
Expand Down Expand Up @@ -101,9 +101,9 @@ do
if (not isstring(value) or not value:find("%S")) then
return false, "invalid", "name"
end

local allowExistNames = nut.config.get("allowExistNames", true)

-- Fetch existing character names
if (CLIENT and #nut.char.names < 1 and !allowExistNames) then
netstream.Start("nutCharFetchNames")
Expand All @@ -112,7 +112,7 @@ do
nut.char.names = data
end)
end

-- Check whether the chosen character name already exists
if (!nut.config.get("allowExistNames", true)) then
for k, v in pairs(nut.char.names) do
Expand All @@ -121,7 +121,7 @@ do
end
end
end

return true
end,
onAdjust = function(client, data, value, newData)
Expand Down
Loading