diff --git a/entities/entities/nut_item.lua b/entities/entities/nut_item.lua index a8760f6a..224e85be 100644 --- a/entities/entities/nut_item.lua +++ b/entities/entities/nut_item.lua @@ -57,6 +57,7 @@ if (SERVER) then self:PhysicsInit(SOLID_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:setNetVar("id", itemTable.uniqueID) + self:setNetVar("instanceID", itemTable:getID()) self.nutItemID = itemID if (table.Count(itemTable.data) > 0) then @@ -192,11 +193,11 @@ else end function ENT:getItemID() - return self:getNetVar("id", "") + return self:getNetVar("instanceID", "") end function ENT:getItemTable() - return nut.item.list[self:getItemID()] + return nut.item.instances[self:getItemID()] end function ENT:getData(key, default) diff --git a/gamemode/core/derma/cl_inventory.lua b/gamemode/core/derma/cl_inventory.lua index 20be1b44..9d1ad015 100644 --- a/gamemode/core/derma/cl_inventory.lua +++ b/gamemode/core/derma/cl_inventory.lua @@ -6,7 +6,7 @@ renderedIcons = renderedIcons or {} -- To make making inventory variant, This must be followed up. function renderNewIcon(panel, itemTable) -- re-render icons - if ((itemTable.iconCam and !renderedIcons[string.lower(itemTable.model)]) or itemTable.forceRender) then + if ((itemTable.iconCam and not renderedIcons[string.lower(itemTable.model)]) or itemTable.forceRender) then local iconCam = itemTable.iconCam iconCam = { cam_pos = iconCam.pos, @@ -14,7 +14,7 @@ function renderNewIcon(panel, itemTable) cam_fov = iconCam.fov, } renderedIcons[string.lower(itemTable.model)] = true - + panel.Icon:RebuildSpawnIconEx( iconCam ) diff --git a/gamemode/core/libs/sh_character.lua b/gamemode/core/libs/sh_character.lua index bff30dd9..8338bd0d 100644 --- a/gamemode/core/libs/sh_character.lua +++ b/gamemode/core/libs/sh_character.lua @@ -105,7 +105,7 @@ do local allowExistNames = nut.config.get("allowExistNames", true) -- Fetch existing character names - if (CLIENT and #nut.char.names < 1 and !allowExistNames) then + if (CLIENT and #nut.char.names < 1 and not allowExistNames) then netstream.Start("nutCharFetchNames") netstream.Hook("nutCharFetchNames", function(data) @@ -114,7 +114,7 @@ do end -- Check whether the chosen character name already exists - if (!nut.config.get("allowExistNames", true)) then + if (not nut.config.get("allowExistNames", true)) then for k, v in pairs(nut.char.names) do if (v == value) then return false, "A character with this name already exists." @@ -161,7 +161,7 @@ do local minLength = nut.config.get("minDescLen", 16) - if (!value or #value:gsub("%s", "") < minLength) then + if (not value or #value:gsub("%s", "") < minLength) then return false, "descMinLen", minLength end end @@ -244,7 +244,7 @@ do local faction = nut.faction.indices[data.faction] if (faction) then - if (!data.model or !faction.models[data.model]) then + if (not data.model or not faction.models[data.model]) then return false, "needModel" end else @@ -337,7 +337,7 @@ do data[key] = value - if (!noReplication and IsValid(client)) then + if (not noReplication and IsValid(client)) then netstream.Start( receiver or client, "charData", @@ -352,7 +352,7 @@ do local data = character.vars.data or {} if (key) then - if (!data) then + if (not data) then return default end @@ -374,7 +374,7 @@ do data[key] = value - if (!noReplication and IsValid(client)) then + if (not noReplication and IsValid(client)) then local id if ( @@ -396,7 +396,7 @@ do local data = character.vars.vars or {} if (key) then - if (!data) then + if (not data) then return default end diff --git a/gamemode/core/libs/sh_command.lua b/gamemode/core/libs/sh_command.lua index 67ad3f06..4e0126d0 100644 --- a/gamemode/core/libs/sh_command.lua +++ b/gamemode/core/libs/sh_command.lua @@ -28,10 +28,10 @@ function nut.command.add(command, data) -- Or if we specify a usergroup allowed to use this. elseif (data.group) then -- The group property can be a table of usergroups. - if (type(data.group) == "table") then + if istable(data.group) then data.onCheckAccess = function(client) -- Check if the client's group is allowed. - for k, v in ipairs(data.group) do + for _, v in ipairs(data.group) do if (client:IsUserGroup(v)) then return true end @@ -43,7 +43,7 @@ function nut.command.add(command, data) else data.onCheckAccess = function(client) return client:IsUserGroup(data.group) - end + end end end end @@ -68,11 +68,11 @@ function nut.command.add(command, data) local alias = data.alias if (alias) then - if (type(alias) == "table") then - for k, v in ipairs(alias) do + if istable(alias) then + for _, v in ipairs(alias) do nut.command.list[v:lower()] = data end - elseif (type(alias) == "string") then + elseif isstring(alias) then nut.command.list[alias:lower()] = data end end @@ -144,22 +144,37 @@ end if (SERVER) then -- Finds a player or gives an error notification. function nut.command.findPlayer(client, name) - local target = type(name) == "string" and nut.util.findPlayer(name) or NULL + if isstring(name) then + if name == "^" then -- thank you Hein/Hankshark - Tov + return client + elseif name == "@" then + local trace = client:GetEyeTrace().Entity + if IsValid(trace) and trace:IsPlayer() then + return trace + else + client:notifyLocalized("lookToUseAt") + return + end + end + local target = nut.util.findPlayer(name) or NULL - if (IsValid(target)) then - return target + if (IsValid(target)) then + return target + else + client:notifyLocalized("plyNoExist") + end else - client:notifyLocalized("plyNoExist") + client:notifyLocalized("mustProvideString") end end - + -- Finds a faction based on the uniqueID, and then the name if no such uniqueID exists. function nut.command.findFaction(client, name) if (nut.faction.teams[name]) then return nut.faction.teams[name] end - for k, v in ipairs(nut.faction.indices) do + for _, v in ipairs(nut.faction.indices) do if (nut.util.stringMatches(L(v.name,client), name)) then return v --This interrupt means we don't need an if statement below. end @@ -170,7 +185,7 @@ if (SERVER) then -- Forces a player to run a command. function nut.command.run(client, command, arguments) - local command = nut.command.list[command:lower()] + command = nut.command.list[command:lower()] if (command) then -- Run the command's callback and get the return. @@ -178,7 +193,7 @@ if (SERVER) then local result = results[1] -- If a string is returned, it is a notification. - if (type(result) == "string") then + if isstring(result) then -- Normal player here. if (IsValid(client)) then if (result:sub(1, 1) == "@") then @@ -210,8 +225,8 @@ if (SERVER) then match = post[1]:utf8sub(2, len) end - - local match = match:lower() + + match = match:lower() local command = nut.command.list[match] -- We have a valid, registered command. @@ -252,8 +267,8 @@ if (SERVER) then if ((client.nutNextCmd or 0) < CurTime()) then local arguments2 = {} - for k, v in ipairs(arguments) do - if (type(v) == "string" or type(v) == "number") then + for _, v in ipairs(arguments) do + if (isstring(v) or isnumber(v)) then arguments2[#arguments2 + 1] = tostring(v) end end diff --git a/gamemode/core/libs/sh_item.lua b/gamemode/core/libs/sh_item.lua index 9904f2cb..e88616a1 100644 --- a/gamemode/core/libs/sh_item.lua +++ b/gamemode/core/libs/sh_item.lua @@ -19,7 +19,7 @@ function nut.item.load(path, baseID, isBaseItem) if (uniqueID) then uniqueID = (isBaseItem and "base_" or "")..uniqueID nut.item.register(uniqueID, baseID, isBaseItem, path) - elseif (!path:find(".txt")) then + elseif (not path:find(".txt")) then ErrorNoHalt( "[NutScript] Item at '"..path.."' follows invalid ".. "naming convention!\n" @@ -102,23 +102,23 @@ function nut.item.loadFromDir(directory) files = file.Find(directory.."/base/*.lua", "LUA") - for k, v in ipairs(files) do + for _, v in ipairs(files) do nut.item.load(directory.."/base/"..v, nil, true) end files, folders = file.Find(directory.."/*", "LUA") - for k, v in ipairs(folders) do + for _, v in ipairs(folders) do if (v == "base") then continue end - for k2, v2 in ipairs(file.Find(directory.."/"..v.."/*.lua", "LUA")) do + for _, v2 in ipairs(file.Find(directory.."/"..v.."/*.lua", "LUA")) do nut.item.load(directory.."/"..v .. "/".. v2, "base_"..v) end end - for k, v in ipairs(files) do + for _, v in ipairs(files) do nut.item.load(directory.."/"..v) end end diff --git a/gamemode/core/libs/sv_database.lua b/gamemode/core/libs/sv_database.lua index 14ffb632..1e374b42 100644 --- a/gamemode/core/libs/sv_database.lua +++ b/gamemode/core/libs/sv_database.lua @@ -72,7 +72,7 @@ modules.tmysql4 = { if (result) then result = result[1] - local queryStatus, queryError, affected, lastID, time, data = result.status, result.error, result.affected, result.lastid, result.time, result.data + local queryStatus, queryError, affected, lastID, time, data = result.status, result.error, result.affected, result.lastid, result.time, result.data if (queryStatus and queryStatus == true and callback) then callback(data, lastID) @@ -116,7 +116,7 @@ modules.tmysql4 = { end else ThrowConnectionFault(fault) - end + end end } diff --git a/gamemode/core/libs/thirdparty/sh_ease.lua b/gamemode/core/libs/thirdparty/sh_ease.lua index e7bd680e..0f94db17 100644 --- a/gamemode/core/libs/thirdparty/sh_ease.lua +++ b/gamemode/core/libs/thirdparty/sh_ease.lua @@ -3,7 +3,7 @@ -- check the ease cheatsheet for your neat UI and stuffs! http://easings.net nut.ease = nut.ease or {} - + local pow = math.pow local sin = math.sin local pi = math.pi @@ -11,76 +11,76 @@ local easeIn, easeOut, easeInOut, easeOutIn local easeInBack, easeOutBack, easeInOutBack, easeOutInBack local easeInElastic, easeOutElastic, easeInOutElastic, easeOutInElastic local easeInBounce, easeOutBounce, easeInOutBounce, easeOutInBounce - + function nut.ease.easeIn(t, tMax, start, delta) return start + (delta * easeIn(t / tMax)) end - + function nut.ease.easeOut(t, tMax, start, delta) return start + (delta * easeOut(t / tMax)) end - + function nut.ease.easeInOut(t, tMax, start, delta) return start + (delta * easeInOut(t / tMax)) end - + function nut.ease.easeOutIn(t, tMax, start, delta) return start + (delta * easeOutIn(t / tMax)) end - + function nut.ease.easeInBack(t, tMax, start, delta) return start + (delta * easeInBack(t / tMax)) end - + function nut.ease.easeOutBack(t, tMax, start, delta) return start + (delta * easeOutBack(t / tMax)) end - + function nut.ease.easeInOutBack(t, tMax, start, delta) return start + (delta * easeInOutBack(t / tMax)) end - + function nut.ease.easeOutInBack(t, tMax, start, delta) return start + (delta * easeOutInBack(t / tMax)) end - + function nut.ease.easeInElastic(t, tMax, start, delta) return start + (delta * easeInElastic(t / tMax)) end - + function nut.ease.easeOutElastic(t, tMax, start, delta) return start + (delta * easeOutElastic(t / tMax)) end - + function nut.ease.easeInOutElastic(t, tMax, start, delta) return start + (delta * easeInOutElastic(t / tMax)) end - + function nut.ease.easeOutInElastic(t, tMax, start, delta) return start + (delta * easeOutInElastic(t / tMax)) end - + function nut.ease.easeInBounce(t, tMax, start, delta) return start + (delta * easeInBounce(t / tMax)) end - + function nut.ease.easeOutBounce(t, tMax, start, delta) return start + (delta * easeOutBounce(t / tMax)) end - + function nut.ease.easeInOutBounce(t, tMax, start, delta) return start + (delta * easeInOutBounce(t / tMax)) end - + function nut.ease.easeOutInBounce(t, tMax, start, delta) return start + (delta * easeOutInBounce(t / tMax)) end - + -- local easing functions easeInBounce = function(ratio) return 1.0 - easeOutBounce(1.0 - ratio) end - + easeOutBounce = function(ratio) local s = 7.5625 local p = 2.75 @@ -103,7 +103,7 @@ easeOutBounce = function(ratio) end return l end - + easeInOutBounce = function(ratio) if (ratio < 0.5) then return 0.5 * easeInBounce(ratio * 2.0) @@ -111,7 +111,7 @@ easeInOutBounce = function(ratio) return 0.5 * easeOutBounce((ratio - 0.5) * 2.0) + 0.5 end end - + easeOutInBounce = function(ratio) if (ratio < 0.5) then return 0.5 * easeOutBounce(ratio * 2.0) @@ -119,25 +119,24 @@ easeOutInBounce = function(ratio) return 0.5 * easeInBounce((ratio - 0.5) * 2.0) + 0.5 end end - - + easeInElastic = function(ratio) if ratio == 0 or ratio == 1.0 then return ratio end - + local p = 0.3 local s = p / 4.0 local invRatio = ratio - 1.0 return -1 * pow(2.0, 10.0 * invRatio) * sin((invRatio - s) * 2 * pi / p) end - + easeOutElastic = function(ratio) if ratio == 0 or ratio == 1.0 then return ratio end - + local p = 0.3 local s = p / 4.0 return -1 * pow(2.0, -10.0 * ratio) * sin((ratio + s) * 2 * pi / p) + 1.0 end - + easeInOutElastic = function(ratio) if (ratio < 0.5) then return 0.5 * easeInElastic(ratio * 2.0) @@ -145,7 +144,7 @@ easeInOutElastic = function(ratio) return 0.5 * easeOutElastic((ratio - 0.5) * 2.0) + 0.5 end end - + easeOutInElastic = function(ratio) if (ratio < 0.5) then return 0.5 * easeOutElastic(ratio * 2.0) @@ -153,16 +152,16 @@ easeOutInElastic = function(ratio) return 0.5 * easeInElastic((ratio - 0.5) * 2.0) + 0.5 end end - + easeIn = function(ratio) return ratio * ratio * ratio end - + easeOut = function(ratio) local invRatio = ratio - 1.0 return (invRatio * invRatio * invRatio) + 1.0 end - + easeInOut = function(ratio) if (ratio < 0.5) then return 0.5 * easeIn(ratio * 2.0) @@ -170,7 +169,7 @@ easeInOut = function(ratio) return 0.5 * easeOut((ratio - 0.5) * 2.0) + 0.5 end end - + easeOutIn = function(ratio) if (ratio < 0.5) then return 0.5 * easeOut(ratio * 2.0) @@ -178,18 +177,18 @@ easeOutIn = function(ratio) return 0.5 * easeIn((ratio - 0.5) * 2.0) + 0.5 end end - + easeInBack = function(ratio) local s = 1.70158 return pow(ratio, 2.0) * ((s + 1.0) * ratio - s) end - + easeOutBack = function(ratio) local invRatio = ratio - 1.0 local s = 1.70158 return pow(invRatio, 2.0) * ((s + 1.0) * invRatio + s) + 1.0 end - + easeInOutBack = function(ratio) if (ratio < 0.5) then return 0.5 * easeInBack(ratio * 2.0) @@ -197,7 +196,7 @@ easeInOutBack = function(ratio) return 0.5 * easeOutBack((ratio - 0.5) * 2.0) + 0.5 end end - + easeOutInBack = function(ratio) if (ratio < 0.5) then return 0.5 * easeOutBack(ratio * 2.0) diff --git a/gamemode/core/meta/sh_character.lua b/gamemode/core/meta/sh_character.lua index 05b204c5..7a79834a 100644 --- a/gamemode/core/meta/sh_character.lua +++ b/gamemode/core/meta/sh_character.lua @@ -97,7 +97,7 @@ if (SERVER) then end end - -- Sets up the "appearance" related inforomation for the character. + -- Sets up the "appearance" related information for the character. function CHAR:setup(noNetworking) local client = self:getPlayer() @@ -141,7 +141,7 @@ if (SERVER) then local isCurrentChar = self and self:getID() == id -- Return the player to the character menu. - if (self and self.steamID == steamID) then + if (self and self.steamID == steamID) then netstream.Start(client, "charKick", id, isCurrentChar) if (isCurrentChar) then @@ -200,12 +200,10 @@ function CHAR:getPlayer() else for k, v in ipairs(player.GetAll()) do local char = v:getChar() - if (char) then - if (char:getID() == self:getID()) then - self.player = v + if char and (char:getID() == self:getID()) then + self.player = v - return v - end + return v end end end diff --git a/gamemode/languages/sh_english.lua b/gamemode/languages/sh_english.lua index 99330dd7..26f10444 100644 --- a/gamemode/languages/sh_english.lua +++ b/gamemode/languages/sh_english.lua @@ -259,5 +259,9 @@ LANGUAGE = { panelAdded = "You have added a 3D panel.", itemOnGround = "Your item has been placed on the ground.", forbiddenActionStorage = "You can't do this action with storaged item.", - cantDropBagHasEquipped = "You can't drop bag that has equipped item." + cantDropBagHasEquipped = "You can't drop bag that has equipped item.", + + -- 2021 patch + lookToUseAt = "You need to be looking at someone to use '@'", + mustProvideString = "You must provide a string for the variable", } diff --git a/gamemode/languages/sh_russian.lua b/gamemode/languages/sh_russian.lua index 99af7f46..b89e7fbc 100644 --- a/gamemode/languages/sh_russian.lua +++ b/gamemode/languages/sh_russian.lua @@ -5,6 +5,7 @@ Shadow Nova (http://steamcommunity.com/profiles/76561197989134302), Schwarz Kruppzo (http://steamcommunity.com/id/schwarzkruppzo), Neon (http://steamcommunity.com/id/ru_neon), kirukiru (https://steamcommunity.com/id/kiruthekillah/) +Tov (https://steamcommunity.com/id/TOVARISCHPOOTIS) --]] NAME = "Русский" @@ -255,5 +256,38 @@ LANGUAGE = { flags = "Флаги", moneyLeft = "Ваши деньги: ", currentMoney = "Осталось денег: ", - moneyGiven = "Вы дали %s" + moneyGiven = "Вы дали %s", + + -- 2021 patch + itemCreated = "Предмет успешно создан.", + flagGiveTitle = "Дать флаги", + flagGiveDesc = "Выдать следующие флаги игроку.", + flagTakeTitle = "Отнять флаги", + flagTakeDesc = "Отнять следующие флаги от игрока.", + limitFaction = "Данная фракция полна. Попробуйте попозже.", + toggleObserverTP = "Переключить телепортирование при наблюдении.", + toggleESPAdvanced = "Переключить расширенный режим ESP", + thirdpersonConfig = "Настройка третьего лица", + ammoLoadAll = "Зарадить всё", + ammoLoadAmount = "Зарадить %s", + ammoLoadCustom = "Зарадить...", + split = "Разделить", + splitHelp = "Введите сумму для разделения.", + splitHalf = "Разделить 1/2", + splitQuarter = "Разделить 1/4", + recognize = "Позволить этому персонажу узнать вашу личность.", + recognized = "Данный персонаж узнал вашу личность.", + already_recognized = "Данный персонаж уже знает вашу личность.", + untying = "Развязывание...", + beingUntied = "Вас развязывают...", + beingTied = "Вас связывают...", + sameOutfitCategory = "Такой вид экипировки на вас уже надет.", + noBusiness = "В данный момент вы не можете ничего купить.", + panelRemoved = "Вы удалили %s 3D панелей.", + panelAdded = "Вы добавили 3D панель.", + itemOnGround = "Вас предмет был положет на землю.", + forbiddenActionStorage = "Действие с хранимым предметом запрещено.", + cantDropBagHasEquipped = "Запрещено бросать сумку с экипированным предметом.", + lookToUseAt = "Необходимо смотреть на игрока для использования '@'", + mustProvideString = "Необходимо предьявить строковую для этой функции", } diff --git a/plugins/doors/sh_commands.lua b/plugins/doors/sh_commands.lua index 9227ca70..c08ad6a2 100644 --- a/plugins/doors/sh_commands.lua +++ b/plugins/doors/sh_commands.lua @@ -406,10 +406,10 @@ nut.command.add("doorsethidden", { -- Validate it is a door. if (IsValid(entity) and entity:isDoor()) then - local hidden = util.tobool(arguments[1] or true) + local hidden = tobool(arguments[1] or true) entity:setNetVar("hidden", hidden) - + PLUGIN:callOnDoorChildren(entity, function(child) child:setNetVar("hidden", hidden) end) diff --git a/plugins/raiseweapons/cl_hooks.lua b/plugins/raiseweapons/cl_hooks.lua index b6784764..90a398fb 100644 --- a/plugins/raiseweapons/cl_hooks.lua +++ b/plugins/raiseweapons/cl_hooks.lua @@ -4,7 +4,7 @@ local LOWERED_ANGLES = Angle(30, -30, -25) function PLUGIN:CalcViewModelView(weapon, viewModel, oldEyePos, oldEyeAngles, eyePos, eyeAngles) if (not IsValid(weapon)) then return end - local vm_origin, vm_angles = eyePos, eyeAngles + local vm_angles = eyeAngles local client = LocalPlayer() local value = 0 @@ -14,11 +14,11 @@ function PLUGIN:CalcViewModelView(weapon, viewModel, oldEyePos, oldEyeAngles, ey local fraction = (client.nutRaisedFrac or 0) / 100 local rotation = weapon.LowerAngles or LOWERED_ANGLES - + if (NUT_CVAR_LOWER2:GetBool() and weapon.LowerAngles2) then rotation = weapon.LowerAngles2 end - + vm_angles:RotateAroundAxis(vm_angles:Up(), rotation.p * fraction) vm_angles:RotateAroundAxis(vm_angles:Forward(), rotation.y * fraction) vm_angles:RotateAroundAxis(vm_angles:Right(), rotation.r * fraction) diff --git a/plugins/vignette.lua b/plugins/vignette.lua index 20269be6..1142cc34 100644 --- a/plugins/vignette.lua +++ b/plugins/vignette.lua @@ -34,7 +34,7 @@ end) function PLUGIN:HUDPaintBackground() local frameTime = FrameTime() - local scrW, scrH = surface.ScreenWidth(), surface.ScreenHeight() + local scrW, scrH = ScrW(), ScrH() if (hasVignetteMaterial and nut.config.get("vignette")) then vignetteAlphaDelta =