Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions entities/entities/nut_item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ if (SERVER) then

local model = itemTable.onGetDropModel
and itemTable:onGetDropModel(self)
or itemTable.model
or itemTable:getModel() or itemTable.model
if (itemTable.worldModel) then
model = itemTable.worldModel == true
and "models/props_junk/cardboard_box004a.mdl"
or itemTable.worldModel
end

self:SetSkin(itemTable.skin or 0)
self:SetModel(model)
self:SetSkin(itemTable.skin or 0)
self:SetMaterial(itemTable.material or "")
self:SetColor(itemTable.color or Color(255,255,255))
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:setNetVar("id", itemTable.uniqueID)
Expand Down
5 changes: 5 additions & 0 deletions gamemode/config/sh_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ nut.config.add("oocDelay", 10, "The delay before a player can use OOC chat again
category = "chat"
})

nut.config.add("oocLimit", 0, "Character limit per OOC message. 0 means no limit", nil, {
data = {min = 0, max = 1000},
category = "chat"
})

nut.config.add("oocDelayAdmin", false, "Whether or not OOC chat delay is enabled for admins.", nil, {
category = "chat"
})
Expand Down
7 changes: 6 additions & 1 deletion gamemode/core/libs/sh_chatbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ do
return false
end
end

-- Save the last time they spoke in OOC.
speaker.nutLastOOC = CurTime()
end
Expand Down Expand Up @@ -331,6 +330,9 @@ do
icon = "icon16/heart.png"
end

if (nut.config.get("oocLimit", 0) ~= 0) and (#text > nut.config.get("oocLimit", 0)) then
text = string.sub(text, 1, nut.config.get("oocLimit", 0)) .. "..."
end
icon = Material(hook.Run("GetPlayerIcon", speaker) or icon)

chat.AddText(icon, nut.chat.timestamp(true), Color(255, 50, 50), " [OOC] ", speaker, color_white, ": " .. text)
Expand Down Expand Up @@ -361,6 +363,9 @@ do
speaker.nutLastLOOC = CurTime()
end,
onChatAdd = function(speaker, text)
if (nut.config.get("oocLimit", 0) ~= 0) and (#text > nut.config.get("oocLimit", 0)) then
text = string.sub(text, 1, nut.config.get("oocLimit", 0)) .. "..."
end
chat.AddText(nut.chat.timestamp(false), Color(255, 50, 50), "[LOOC] ", nut.config.get("chatColor"), speaker:Name() .. ": " .. text)
end,
radius = function()
Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/libs/sh_player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ do
end

-- Whitelist networking information here.
do
do
function playerMeta:hasWhitelist(faction)
local data = nut.faction.indices[faction]

Expand Down
48 changes: 24 additions & 24 deletions gamemode/core/libs/thirdparty/cl_ikon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

TL;DR: https://tldrlegal.com/license/mit-license
OK -
OK -
Commercial Use
Modify
Distribute
Sublicense
Private Use

NOT OK -
Hold Liable

MUST -
Include Copyright
Include License
Expand All @@ -58,7 +58,7 @@ function ikon:init()
hook.Add("HUDPaint", "ikon_dev2", ikon.showResult)
else
hook.Remove("HUDPaint", "ikon_dev2")
end
end

/*
Being good at gmod is knowing all of stinky hacks
Expand Down Expand Up @@ -101,7 +101,7 @@ local TEXTURE_FLAGS_CLAMP_T = 0x0008
ikon.max = ikon.maxSize * 64
ikon.RT = GetRenderTargetEx("nsIconRendered",
ikon.max,
ikon.max,
ikon.max,
RT_SIZE_NO_CHANGE,
MATERIAL_RT_DEPTH_SHARED,
bit.bor(TEXTURE_FLAGS_CLAMP_S, TEXTURE_FLAGS_CLAMP_T),
Expand Down Expand Up @@ -133,10 +133,10 @@ function ikon:renderHook()

local w, h = ikon.curWidth * 64, ikon.curHeight * 64
local x, y = 0, 0

local tab
if (ikon.info) then
tab =
tab =
{
origin = ikon.info.pos,
angles = ikon.info.ang,
Expand Down Expand Up @@ -183,32 +183,32 @@ function ikon:renderHook()
render.SetStencilPassOperation(STENCILOPERATION_REPLACE)
render.SetStencilFailOperation(STENCILOPERATION_REPLACE)
end

/*
Add more effects on the Models!
*/
if (tab.drawHook) then
tab.drawHook(ikon.renderEntity, w, h)
end
cam.Start3D(tab.origin, tab.angles, tab.fov, 0, 0, w, h)


cam.Start3D(tab.origin, tab.angles, tab.fov, 0, 0, w, h)
if (tab.entAng) then
ikon.renderEntity:SetAngles(tab.entAng)
else
ikon.renderEntity:SetAngles(Angle())
end

render.SetBlend(1)
ikon.renderEntity:DrawModel()
ikon.renderEntity:DrawModel()
cam.End3D()

if (tab.drawPostHook) then
render.SetColorModulation( 1, 1, 1 )

tab.drawPostHook(ikon.renderEntity, w, h)
end


if (tab.outline) then
render.PushRenderTarget( tex_effect )
Expand All @@ -217,7 +217,7 @@ function ikon:renderHook()
cam.Start2D()
cam.Start3D(tab.origin, tab.angles, tab.fov, 0, 0, w, h)
render.SetBlend(0)
ikon.renderEntity:DrawModel()
ikon.renderEntity:DrawModel()

render.SetStencilWriteMask(138) -- could you please?
render.SetStencilTestMask(1)
Expand All @@ -232,10 +232,10 @@ function ikon:renderHook()
cam.End3D()
cam.End2D()
render.PopRenderTarget()

render.SetBlend(1)
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_NOTEQUAL)

/*
Thanks for Noiwex
NxServ.eu
Expand All @@ -250,7 +250,7 @@ function ikon:renderHook()

render.SetStencilEnable(false)
end

render.SuppressEngineLighting( false )
render.SetWriteDepthToDestAlpha( true )
end, function(rrer) print(rrer) end)
Expand Down Expand Up @@ -293,7 +293,7 @@ function ikon:renderIcon(name, w, h, mdl, camInfo, updateCache)

local w, h = ikon.curWidth * 64, ikon.curHeight * 64
local sw, sh = ScrW(), ScrH()

if (ikon.renderModel) then
if (!IsValid(ikon.renderEntity)) then
ikon.renderEntity = ClientsideModel(ikon.renderModel, RENDERGROUP_BOTH)
Expand All @@ -304,7 +304,7 @@ function ikon:renderIcon(name, w, h, mdl, camInfo, updateCache)
ikon.renderEntity:SetModel(ikon.renderModel)
local oldRT = render.GetRenderTarget()
render.PushRenderTarget(ikon.RT)

ikon.rendering = true
ikon:renderHook()
ikon.rendering = nil
Expand All @@ -320,7 +320,7 @@ function ikon:renderIcon(name, w, h, mdl, camInfo, updateCache)
file.Write("nsIcon/" .. schemaName .. "/" .. name .. ".png", capturedIcon)
ikon.info = nil
render.PopRenderTarget()

if (updateCache) then
local iconString = tostring(os.time())
file.Write(iconString .. ".png", capturedIcon)
Expand Down Expand Up @@ -348,7 +348,7 @@ function ikon:getIcon(name)

if (file.Exists("nsIcon/" .. schemaName .. "/" .. name .. ".png", "DATA")) then
ikon.cache[name] = Material("../data/nsIcon/" .. schemaName .. "/".. name ..".png")
return ikon.cache[name] -- yeah return cache
return ikon.cache[name] -- yeah return cache
else
return false -- retryd
end
Expand All @@ -359,7 +359,7 @@ end
concommand.Add("nut_flushicon", function()
ikon.cache = {}
local caf = "nsIcon/" .. schemaName .. "/*.png"

for k, v in ipairs(file.Find(caf, "DATA")) do
file.Delete("nsIcon/" .. schemaName .. "/" .. v)
end
Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/meta/item/sv_item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function ITEM:transfer(newInventory,bBypass)
:next(function()
newInventory:add(self)
end)

return true
end

Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/meta/sh_base_inventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ end
function Inventory:getItemCount(itemType)
local count = 0
for _, item in pairs(self:getItems()) do
if (item.uniqueID == itemType) then
if (itemType and item.uniqueID == itemType or true) then
count = count + item:getQuantity()
end
end
Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/sh_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ do
local vectorLength2D = FindMetaTable("Vector").Length2D

function playerMeta:isRunning()
return vectorLength2D(self.GetVelocity(self)) > (self.GetWalkSpeed(self) + 10)
return vectorLength2D(self:GetVelocity()) > (self:GetWalkSpeed() + 10)
end

-- Checks if the player has a female model.
Expand Down
2 changes: 1 addition & 1 deletion gamemode/items/base/sh_ammo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end

function ITEM:paintOver(item, w, h)
local quantity = item:getQuantity()

nut.util.drawText(quantity, 8, 5, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, "nutChatFont")
end

Expand Down
4 changes: 2 additions & 2 deletions gamemode/items/base/sh_pacoutfit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ end

function ITEM:removePart(client)
local char = client:getChar()

self:setData("equip", false)

if (client.removePart) then
Expand Down Expand Up @@ -116,7 +116,7 @@ ITEM.functions.Equip = {
char:addBoost(item.uniqueID, attribute, boost)
end
end

return false
end,
onCanRun = function(item)
Expand Down
6 changes: 3 additions & 3 deletions gamemode/items/base/sh_weapons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ ITEM.functions.EquipUn = { -- sorry, for name order.
local weapon = item.player.carryWeapons[item.weaponCategory]

if (!weapon or !IsValid(weapon)) then
weapon = item.player:GetWeapon(item.class)
weapon = item.player:GetWeapon(item.class)
end

if (weapon and weapon:IsValid()) then
item:setData("ammo", weapon:Clip1())

item.player:StripWeapon(item.class)
else
print(Format("[Nutscript] Weapon %s does not exist!", item.class))
Expand Down Expand Up @@ -101,7 +101,7 @@ ITEM.functions.Equip = {
end
end
end

if (client:HasWeapon(item.class)) then
client:StripWeapon(item.class)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function PANEL:Init()
self.weightBar:Dock(FILL)
self.weightBar:DockMargin(PADDING, PADDING, PADDING, PADDING)
self.weightBar.Paint = function(this, w, h) self:paintWeightBar(w, h) end

self.weightLabel = self.weight:Add("DLabel")
self.weightLabel:SetText("WEIGHT: 0/10KG")
self.weightLabel:SetFont("nutChatFont")
Expand Down Expand Up @@ -122,7 +122,7 @@ end
function PANEL:Center()
local parent = self:GetParent()
local centerX, centerY = ScrW() * 0.5, ScrH() * 0.5

self:SetPos(
centerX - (self:GetWide() * 0.5),
centerY - (self:GetTall() * 0.5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (CLIENT) then
local panel = parent:Add("nutListInventory")
panel:setInventory(inventory)
panel:Center()

return panel
end

Expand Down
2 changes: 2 additions & 0 deletions plugins/gridinv/items/base/sh_bags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ITEM.model = "models/props_c17/suitcase001a.mdl"
ITEM.category = "Storage"
ITEM.isBag = true

local SOUND_BAG_RESPONSE = {"physics/cardboard/cardboard_box_impact_soft2.wav", 50}

-- The size of the inventory held by this item.
ITEM.invWidth = 2
ITEM.invHeight = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function PANEL:drawHeldItemRectangle()
local trimX, trimY
local maxOffsetY = (item.height or 1) - 1
local maxOffsetX = (item.width or 1) - 1
local drawTarget = nil
local drawTarget = nil
for itemID, invItem in pairs(self.inventory.items) do
if (item:getID() == itemID) then continue end

Expand All @@ -162,7 +162,7 @@ function PANEL:drawHeldItemRectangle()

if (
x + (item.width - 1) >= targetX and x <= targetX + targetW and
y + (item.height - 1) >= targetY and y <= targetY + targetH and
y + (item.height - 1) >= targetY and y <= targetY + targetH and
(invItem.onCombine or item.onCombineTo)
) then
drawTarget = {
Expand Down Expand Up @@ -221,7 +221,7 @@ end
function PANEL:Center()
local parent = self:GetParent()
local centerX, centerY = ScrW() * 0.5, ScrH() * 0.5

self:SetPos(
centerX - (self:GetWide() * 0.5),
centerY - (self:GetTall() * 0.5)
Expand Down
Loading