From 4ec7d6ffe4d6c2a8cfeba5e08fa0e9fd324af870 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Tue, 6 Apr 2021 19:26:51 +0300 Subject: [PATCH 01/50] add default stamina and stamina regen configs --- plugins/stamina/sh_plugin.lua | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/plugins/stamina/sh_plugin.lua b/plugins/stamina/sh_plugin.lua index ec89b7cc..136b1f5a 100644 --- a/plugins/stamina/sh_plugin.lua +++ b/plugins/stamina/sh_plugin.lua @@ -1,10 +1,21 @@ PLUGIN.name = "Stamina" PLUGIN.author = "Chessnut" PLUGIN.desc = "Adds a stamina system to limit running." +local PLUGIN = PLUGIN + +nut.config.add("defaultStamina", 100, "A higher number means that characters can run longer without tiring.", nil, +{ data = {min = 50, max = 500}, + category = "stamina" +}) + +nut.config.add("staminaRegenMultiplier", 1, "A higher number means that characters can run regenerate stamina faster.",nil, +{ data = {min = 0.1, max = 20}, + category = "stamina" +}) if (SERVER) then function PLUGIN:PostPlayerLoadout(client) - client:setLocalVar("stm", 100) + client:setLocalVar("stm", nut.config.get("defaultStamina", 100)) local uniqueID = "nutStam"..client:SteamID() local offset = 0 @@ -20,7 +31,7 @@ if (SERVER) then return end - local bonus = character.getAttrib + local bonus = character.getAttrib and character:getAttrib("stm", 0) or 0 runSpeed = nut.config.get("runSpeed") + bonus @@ -30,27 +41,28 @@ if (SERVER) then end if (client:isRunning()) then - local bonus = character.getAttrib + bonus = character.getAttrib and character:getAttrib("end", 0) or 0 offset = -2 + (bonus / 60) elseif (offset > 0.5) then - offset = 1 + offset = 1 * nut.config.get("staminaRegenMultiplier", 1) else - offset = 1.75 + offset = 1.75 * nut.config.get("staminaRegenMultiplier", 1) end - if (client:Crouching()) then offset = offset + 1 end local current = client:getLocalVar("stm", 0) - local value = math.Clamp(current + offset, 0, 100) + local value = math.Clamp(current + offset, 0, nut.config.get("defaultStamina", 100)) if (current ~= value) then + print(PLUGIN.staminaRegen, offset) + --awprint(nut.config.get("defaultStamina", 100)) client:setLocalVar("stm", value) - if (value == 0 and !client:getNetVar("brth", false)) then + if (value == 0 and not client:getNetVar("brth", false)) then client:SetRunSpeed(nut.config.get("walkSpeed")) client:setNetVar("brth", true) @@ -67,12 +79,12 @@ if (SERVER) then function playerMeta:restoreStamina(amount) local current = self:getLocalVar("stm", 0) - local value = math.Clamp(current + amount, 0, 100) + local value = math.Clamp(current + amount, 0, nut.config.get("defaultStamina", 100)) self:setLocalVar("stm", value) end elseif (nut.bar) then nut.bar.add(function() - return LocalPlayer():getLocalVar("stm", 0) / 100 + return LocalPlayer():getLocalVar("stm", 0) / nut.config.get("defaultStamina", 100) end, Color(200, 200, 40), nil, "stm") end From 547b37a3b896cff895c7a01ec32a7f1a19490da5 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Wed, 7 Apr 2021 11:52:07 +0300 Subject: [PATCH 02/50] Update sh_plugin.lua --- plugins/stamina/sh_plugin.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/stamina/sh_plugin.lua b/plugins/stamina/sh_plugin.lua index 136b1f5a..c927fd32 100644 --- a/plugins/stamina/sh_plugin.lua +++ b/plugins/stamina/sh_plugin.lua @@ -58,8 +58,6 @@ if (SERVER) then local value = math.Clamp(current + offset, 0, nut.config.get("defaultStamina", 100)) if (current ~= value) then - print(PLUGIN.staminaRegen, offset) - --awprint(nut.config.get("defaultStamina", 100)) client:setLocalVar("stm", value) if (value == 0 and not client:getNetVar("brth", false)) then From 10157e6d87d29bfef8c87649ceb4a308f89774b4 Mon Sep 17 00:00:00 2001 From: VindoesCompooter <100soundsystem32@gmail.com> Date: Thu, 8 Apr 2021 16:47:21 +0100 Subject: [PATCH 03/50] Override description in nshud Allows the player in question to override the nshud description for a player. --- plugins/nshud/sh_plugin.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/nshud/sh_plugin.lua b/plugins/nshud/sh_plugin.lua index 8548a2ca..a8a54a79 100644 --- a/plugins/nshud/sh_plugin.lua +++ b/plugins/nshud/sh_plugin.lua @@ -116,7 +116,7 @@ function PLUGIN:DrawEntityInfo(entity, alpha, position) teamGetColor(entity.Team(entity)) } - local description = character.getDesc(character) + local description = hookRun("GetDisplayedDescription", entity) or character.getDesc(character) if (description ~= entity.nutDescCache) then entity.nutDescCache = description From 40b2bd94e6bd445e465c6aba6798ce8f67f5c8f1 Mon Sep 17 00:00:00 2001 From: baratoxis <33399712+baratoxis@users.noreply.github.com> Date: Sun, 11 Apr 2021 00:41:05 +0100 Subject: [PATCH 04/50] Changed the discord @ for contact --- gamemode/languages/sh_spanish.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemode/languages/sh_spanish.lua b/gamemode/languages/sh_spanish.lua index e17b0b3d..6e77f2da 100644 --- a/gamemode/languages/sh_spanish.lua +++ b/gamemode/languages/sh_spanish.lua @@ -1,4 +1,4 @@ -NAME = "Español" ---//Edited by Barata\\---- +NAME = "Español" ---//Contact DasBarata#2411 if you have any translation change suggestion\\---- LANGUAGE = { loading = "Cargando", From afd36cde415a48b9d1f76df8e6e251f47d783ddb Mon Sep 17 00:00:00 2001 From: baratoxis <33399712+baratoxis@users.noreply.github.com> Date: Sun, 11 Apr 2021 16:50:04 +0100 Subject: [PATCH 05/50] Added Portuguese (#53) Added Portuguese --- gamemode/languages/sh_portuguese.lua | 267 +++++++++++++++++++++++++++ 1 file changed, 267 insertions(+) create mode 100644 gamemode/languages/sh_portuguese.lua diff --git a/gamemode/languages/sh_portuguese.lua b/gamemode/languages/sh_portuguese.lua new file mode 100644 index 00000000..3ef7de27 --- /dev/null +++ b/gamemode/languages/sh_portuguese.lua @@ -0,0 +1,267 @@ +NAME = "Portuguese" ---//Contact DasBarata#2411 if you have any translation change suggestion\\---- + + +LANGUAGE = { + loading = "A carregar", + dbError = "Erro ao conectar à database", + unknown = "Desconhecido", + noDesc = "Nenhuma descrição disponível", + create = "Criar", + createTip = "Criar um novo personagem para jogar como.", + load = "Carregar", + loadTip = "Escolhe um personagem que já tenhas criado.", + leave = "Sair", + leaveTip = "Sair do servidor atual.", + ["return"] = "Retornar", + returnTip = "Retornar ao menu anterior.", + name = "Nome", + desc = "Descrição", + attribs = "Atributos", + charCreateTip = "Preenche os campos abaixo e pressiona 'Acabar' para criar o teu personagem.", + invalid = "Deste uma %s inválida", + descMinLen = "A tua descrição têm de ter pelo menos %d caracteres.", + model = "Modelo", + player = "Jogador", + finish = "Acabar", + finishTip = "Acabar de criar o teu personagem.", + needModel = "Escolhe um modelo válido", + creating = "O teu personagem está a ser criado...", + unknownError = "Ocorreu um erro desconhecido.", + delConfirm = "Tens a certeza que queres apagar %s PERMANENTEMENTE?", + no = "Não", + yes = "Sim", + itemInfo = "Nome: %s\nDescrição: %s", + itemCreated = "Objecto criado com sucesso.", + cloud_no_repo = "O repositório providenciado não é valido.", + cloud_no_plugin = "O plugin providenciado não é válido.", + inv = "Inventário", + plugins = "Plugins", + author = "Autor", + version = "Versão", + characters = "Personagens", + settings = "Definições", + config = "Configuração", + chat = "Chat", + appearance = "Aparencia", + misc = "Diversos", + oocDelay = "Deves esperar %s mais segundos antes de usares o OOC de novo.", + loocDelay = "Deves esperar %s mais segundos antes de usares o LOOC de novo.", + usingChar = "Já estás a usar este personagem.", + notAllowed = "Desculpa, não podes fazer isto.", + itemNoExist = "Desculpa, o item que pediste não existe.", + cmdNoExist = "Desculpa, o comando não existe.", + plyNoExist = "Desculpa, um jogador que procuras não foi encontrado.", + cfgSet = "%s mudou \"%s\" para %s.", + drop = "Largar", + dropTip = "Solta este objecto do teu inventário.", + take = "Levar", + takeTip = "Leva este item e põe no teu inventário.", + dTitle = "Porta sem dono", + dTitleOwned = "Porta Comprada", + dIsNotOwnable = "Esta porta não pode ser comprada.", + dIsOwnable = "Podes comprar esta porta ao clicar F2.", + dMadeUnownable = "Fizeste esta porta não ser comprável.", + dMadeOwnable = "Fizeste esta porta ser compravel.", + dNotAllowedToOwn = "Não podes comprar esta porta.", + dSetDisabled = "Desativaste esta porta.", + dSetNotDisabled = "Esta porta já não está desativada.", + dSetHidden = "Escondeste a porta.", + dSetNotHidden = "Esta porta já não está escondida.", + dSetParentDoor = "Tornaste esta porta numa porta parente.", + dCanNotSetAsChild = "Não pode tornar esta porta parente numa porta criança.", + dAddChildDoor = "Adicionaste esta porta como porta criança.", + dRemoveChildren = "Removeste todos os filhos de esta porta.", + dRemoveChildDoor = "Removeste esta porta de ser filho.", + dNoParentDoor = "Não tens uma porta parente definida.", + dOwnedBy = "Este porta é propriedade de %s.", + dConfigName = "Portas", + dSetFaction = "Esta porta pertence à facção %s.", + dRemoveFaction = "Esta porta já não pertence a uma facção.", + dNotValid = "Não estás a olhar para uma porta válida.", + canNotAfford = "Não tens dinheiro suficiente para comprar isto.", + dPurchased = "Compraste esta porta por %s.", + dSold = "Vendeste esta porta por %s.", + notOwner = "Não és o dono disto.", + invalidArg = "Deste um valor invalido para o argumento #%s.", + flagGive = "%s deu %s '%s' flags.", + flagGiveTitle = "Dar Flags", + flagGiveDesc = "Dar as flags seguintes ao jogador.", + flagTake = "%s tirou '%s' flags de %s.", + flagTakeTitle = "Tirar Flags", + flagTakeDesc = "Remover Flags do jogador.", + flagNoMatch = "Tu deves ter a Flag \"%s\" para fazeres isto.", + textAdded = "Adicionaste texto.", + textRemoved = "Removeste %s textos.", + moneyTaken = "Encontraste %s.", + businessPurchase = "Compraste %s por %s.", + businessSell = "Vendeste %s por %s.", + cChangeModel = "%s mudou o modelo de %s para %s.", + cChangeName = "%s mudou o nome de %s para %s.", + cChangeSkin = "%s mudou a skin de %s para %s.", + cChangeGroups = "%s mudou o bodygroup de %s \"%s\" para %s.", + cChangeFaction = "%s transferiu %s para a facção %s.", + playerCharBelonging = "Isto pertence a outro personagem.", + business = "Negócios", + invalidFaction = "Deste uma facção inválida.", + limitFaction = "Esta facção está cheia. Tenta mais tarde.", + spawnAdd = "Adicionaste um spawn para a %s.", + spawnDeleted = "Removeste %s spawn point(s).", + someone = "Alguém", + rgnLookingAt = "Permite que a pessoa te reconheça.", + rgnWhisper = "Permite que a(s) pessoa(s) na area de sussuro te reconheçam.", + rgnTalk = "Permite que a(s) pessoa(s) na area de fala te reconheçam.", + rgnYell = "Permite que a(s) pessoa(s) na area de gritar te reconheçam.", + icFormat = "%s diz \"%s\"", + rollFormat = "%s deu roll a %s.", + wFormat = "%s sussurra \"%s\"", + yFormat = "%s grita \"%s\"", + sbOptions = "Clica para veres as opções para %s.", + spawnAdded = "Adicionaste um spawn para %s.", + whitelist = "%s deu uma whitelist a %s para a facção %s.", + unwhitelist = "%s tirou uma whitelist a %s para a facção %s.", + gettingUp = "Estás a levantar-te...", + wakingUp = "Estás a ganhar consciência...", + Weapons = "Armas", + checkout = "Vai para o pagamento (%s)", + purchase = "Comprar", + purchasing = "Comprando...", + success = "Sucesso", + buyFailed = "Compra Falhada.", + buyGood = "Compra bem sucedida!", + shipment = "Remessa", + shipmentDesc = "Esta remessa pertence a %s.", + class = "Class", + classes = "Classes", + illegalAccess = "Acesso Ilegal.", + becomeClassFail = "Falhaste a tornar-te %s.", + becomeClass = "Tornaste-te %s.", + attribSet = "Definiste %s %s para %s.", + attribUpdate = "Adicionaste %s %s para %s.", + noFit = "Este item não cabe no teu inventário.", + help = "Ajuda", + commands = "Comandos", + helpDefault = "Selecionar Categoria", + doorSettings = "Definições da porta", + sell = "Vender", + access = "Acesso", + locking = "Trancando esta entidade...", + unlocking = "Desbloqueando esta entidade...", + modelNoSeq = "O teu modelo não suporta este ato.", + notNow = "Não és permitido a fazer isto agora.", + faceWall = "Deves estar a olhar para uma parede para fazer isto.", + faceWallBack = "Deves estar de costas para uma parede para fazer isto.", + descChanged = "Mudaste a aparência do teu personagem.", + charMoney = "Tens %s.", + charFaction = "És membro da facção %s.", + charClass = "Tu %s da facção.", + noSpace = "Inventário está cheio.", + noOwner = "O dono é invalido.", + invalidIndex = "O índice deste item Index é invalido.", + invalidItem = "O objeto deste item Index é invalido.", + invalidInventory = "O objecto do inventário é invaldio.", + home = "Home", + charKick = "%s deu kick ao personagem %s.", + charBan = "%s baniu o personagem %s.", + charBanned = "Este personagem está banido.", + setMoney = "Definiste o dinheiro de %s para %s.", + itemPriceInfo = "Podes comprar este item por %s.\nPodes vender este item por %s", + free = "De Graça", + vendorNoSellItems = "Não existem items para vender.", + vendorNoBuyItems = "Não existem items para comprar.", + vendorSettings = "Definições do vendedor", + vendorUseMoney = "O vendedor deve usar dinheiro?", + vendorNoBubble = "Esconder a bolha do vendedor?", + mode = "Modo", + price = "Preço", + stock = "Stock", + none = "Nenhum", + vendorBoth = "Comprar e Vender", + vendorBuy = "Apenas Comprar", + vendorSell = "Apenas Vender", + maxStock = "Stock Máximo", + vendorFaction = "Editor de Facções", + buy = "Comprar", + vendorWelcome = "Bem vindo à minha loja, o que é que te posso arranjar hoje?", + vendorBye = "Volta brevemente!", + charSearching = "Já estás a procurar um personagem, espera por favor.", + charUnBan = "%s desbaniu o personagem %s.", + charNotBanned = "Este personagem não está banido.", + storPass = "Definiste a password deste armazém para %s.", + storPassRmv = "Removeste a password deste armazém.", + storPassWrite = "Mete a password.", + wrongPassword = "Meteste a password errada.", + cheapBlur = "Desativar obscurecimento? (Aumenta os FPS)", + quickSettings = "Definições rápidas", + vmSet = "Definiste voicemail.", + vmRem = "Removeste o teu voicemail.", + altLower = "Esconder mãos quando abaixadas?", + noPerm = "Não estás permitido a fazer isto.", + youreDead = "Tu estás morto", + injMajor = "Parece estar criticamente ferido.", + injLittle = "Parece magoado", + toggleObserverTP = "Alternar teleportador do Observer", + toggleESP = "Alternar ESP de Admin", + toggleESPAdvanced = "Modo avançado do ESP", + chgName = "Mudar nome", + chgNameDesc = "Põe o novo nome do personagem abaixo.", + thirdpersonToggle = "Alternar Terceira Pessoa", + thirdpersonClassic = "Usar Terceira Pessoa clássica", + thirdpersonConfig = "Configuração da Terceira Pessoa", + equippedBag = "items equipados não podem ser movidos por inventarios.", + useTip = "Usa o item", + equipTip = "Equipa o item.", + unequipTip = "Desequipa o item.", + consumables = "Consumíveis", + plyNotValid = "Não estás a olhar para um jogador valido.", + restricted = "Foste contido.", + viewProfile = "Ver perfil Steam", + salary = "Recebeste %s do teu salário.", + noRecog = "Não reconheces esta pessoa.", + curTime = "São %s.", + vendorEditor = "Editar Vendedor", + edit = "Editar", + disable = "Desabilitar", + vendorPriceReq = "Põe o novo preço para este item.", + vendorEditCurStock = "Edit Current Stock", + you = "Tu", + vendorSellScale = "Escala do Preço de Venda", + vendorNoTrade = "Tu não podes trocar com este vendedor.", + vendorNoMoney = "Este vendedor não têm dinheiro suficiente para esse item.", + vendorNoStock = "Este vendedor não têm esse item em stock.", + contentTitle = "Conteúdo NutScript não encontrado", + contentWarning = "Não tens o conteúdo do NutScript montado. Isto pode resultar em alguns recursos não funcionarem .\nO conteúdo do Nutscript foi mudado para o do rebel1324.\nQueres abrir a pagina da loja para o conteúdo do NutScript?", + flags = "Flags", + chooseTip = "Escolhe este personagem para jogares.", + deleteTip = "Apagar este personagem.", + moneyLeft = "O teu dinheiro: ", + currentMoney = "Dinheiro Restante: ", + + -- 2018 patch + + ammoLoadAll = "Carregar tudo", + ammoLoadAmount = "Carregar %s", + ammoLoadCustom = "Carregar...", + split = "Dividir", + splitHelp = "Mete um número para dividir.", + splitHalf = "Dividir 1/2", + splitQuarter = "Dividir 1/4", + recognize = "Permite que este personagem te reconheça.", + recognized = "Deste a tua identidade a este personagem.", + already_recognized = "Este personagem já te conhece.", + isTied = "Esta personagem já está atada.", + tying = "Atando", + untying = "Desatando", + beingUntied = "Estás a ser desatado.", + beingTied = "Estás a ser atado.", + sameOutfitCategory = "Já estás a vestir uma roupa deste tipo.", + noBusiness = "Não podes comprar nada.", + panelRemoved = "Removeste %s 3D panels.", + panelAdded = "Adicionaste 1 3D panel.", + itemOnGround = "O teu item foi colocado no chão.", + forbiddenActionStorage = "Não podes fazer isto com itens armazenados.", + cantDropBagHasEquipped = "Não podes largar uma mala equipada." + + -- 2021 patch + lookToUseAt = "Precisas de estar a olhar para alguém para usar '@'", + mustProvideString = "Deves dar uma string para a variável", +} From f49e670210aae38d11ad8cd187ad97bfd7ae0b78 Mon Sep 17 00:00:00 2001 From: baratoxis <33399712+baratoxis@users.noreply.github.com> Date: Mon, 12 Apr 2021 23:47:09 +0100 Subject: [PATCH 06/50] Noticed a Missing Comma --- gamemode/languages/sh_portuguese.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemode/languages/sh_portuguese.lua b/gamemode/languages/sh_portuguese.lua index 3ef7de27..2cecab70 100644 --- a/gamemode/languages/sh_portuguese.lua +++ b/gamemode/languages/sh_portuguese.lua @@ -259,7 +259,7 @@ LANGUAGE = { panelAdded = "Adicionaste 1 3D panel.", itemOnGround = "O teu item foi colocado no chão.", forbiddenActionStorage = "Não podes fazer isto com itens armazenados.", - cantDropBagHasEquipped = "Não podes largar uma mala equipada." + cantDropBagHasEquipped = "Não podes largar uma mala equipada.", -- 2021 patch lookToUseAt = "Precisas de estar a olhar para alguém para usar '@'", From 6766f040cbf50d63f1317907d54cef3aa0fd63af Mon Sep 17 00:00:00 2001 From: VindoesCompooter <100soundsystem32@gmail.com> Date: Wed, 14 Apr 2021 06:19:59 +0100 Subject: [PATCH 07/50] Fix items not being returned by d map Fixes hook so that it can return items when bought from a vendor. --- plugins/vendor/sv_hooks.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/vendor/sv_hooks.lua b/plugins/vendor/sv_hooks.lua index 75803475..15eab1f6 100644 --- a/plugins/vendor/sv_hooks.lua +++ b/plugins/vendor/sv_hooks.lua @@ -147,7 +147,8 @@ function PLUGIN:VendorTradeAttempt( local position = client:getItemDropPos() local result = character:getInv():add(itemType) - :next(function() + :next(function(item) + hook.Run("OnCharTradeVendor", client, vendor, item, isSellingToVendor) client.vendorTransaction = nil end) :catch(function(err) @@ -161,8 +162,6 @@ function PLUGIN:VendorTradeAttempt( client:notifyLocalized(err) client.vendorTransaction = nil end) - - hook.Run("OnCharTradeVendor", client, vendor, result.value, isSellingToVendor) nut.log.add(client, "vendorBuy", itemType, vendor:getNetVar("name")) end From b0d3ce6314f721727dca2e43900c30e30ad016d0 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Mon, 19 Apr 2021 13:43:43 +0200 Subject: [PATCH 08/50] Fixed an error when an object can be dropped. Error trace: [ERROR] gamemodes/nutscript/entities/weapons/nut_hands.lua:620: attempt to index global 'ent' (a nil value) 1. allowEntityDrop - gamemodes/nutscript/entities/weapons/nut_hands.lua:620 2. drop - gamemodes/nutscript/entities/weapons/nut_hands.lua:223 3. doPickup - gamemodes/nutscript/entities/weapons/nut_hands.lua:465 4. unknown - gamemodes/nutscript/entities/weapons/nut_hands.lua:417 --- entities/weapons/nut_hands.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/entities/weapons/nut_hands.lua b/entities/weapons/nut_hands.lua index 39addcee..72b8ba31 100644 --- a/entities/weapons/nut_hands.lua +++ b/entities/weapons/nut_hands.lua @@ -611,8 +611,9 @@ end local down = Vector(0, 0, -1) function SWEP:allowEntityDrop() local client = self:GetOwner() + local ent = self.carryHack - if (not IsValid(client)) or (not IsValid(self.carryHack)) then return false end + if (not IsValid(client)) or (not IsValid(ent)) then return false end local ground = client:GetGroundEntity() if ground and (ground:IsWorld() or IsValid(ground)) then return true end From a12234547a358445a21c666326e46a141750a35a Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Mon, 19 Apr 2021 13:46:52 +0200 Subject: [PATCH 09/50] French translations update - Improvement of existing translations. - Update of added translations with the latest versions. --- gamemode/languages/sh_french.lua | 117 ++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 41 deletions(-) diff --git a/gamemode/languages/sh_french.lua b/gamemode/languages/sh_french.lua index 311ed6ce..6e70ad9e 100644 --- a/gamemode/languages/sh_french.lua +++ b/gamemode/languages/sh_french.lua @@ -6,7 +6,7 @@ LANGUAGE = { dbError = "Connexion avec la base de données échouée", unknown = "Inconnu", noDesc = "Aucune description disponible", - create = "Créer", + create = "CrÉer", createTip = "Créer un nouveau personnage pour jouer avec.", load = "Charger", loadTip = "Charger un personnage crée auparavant pour jouer avec.", @@ -21,7 +21,6 @@ LANGUAGE = { charCreateTip = "Remplissez les champs ci-dessous et appuyez sur 'Terminer' pour créer votre personnage.", invalid = "Vous avez fourni un %s invalide", descMinLen = "Votre description doit comporter au moins %d caractère(s).", - model = "Modèle", player = "Joueur", finish = "Terminer", finishTip = "Terminer la création du personnage.", @@ -32,6 +31,7 @@ LANGUAGE = { no = "Non", yes = "Oui", itemInfo = "Nom: %s\nDescription: %s", + itemCreated = "L'objet à été créé avec succès.", cloud_no_repo = "Les référentiels fournies ne sont pas valides.", cloud_no_plugin = "Les plugins fournies ne sont pas valides.", inv = "Inventaire", @@ -39,8 +39,7 @@ LANGUAGE = { author = "Auteur", version = "Version", characters = "Personnages", - business = "Marché", - settings = "Options", + settings = "Paramètres", config = "Configuration", chat = "Chat", appearance = "Apparence", @@ -48,7 +47,6 @@ LANGUAGE = { oocDelay = "Vous devez attendre %s seconde(s) avant de pouvoir utiliser de nouveau le OOC.", loocDelay = "Vous devez attendre %s seconde(s) avant de pouvoir utiliser de nouveau le LOOC.", usingChar = "Vous utilisez déjà ce personnage.", - notAllowed = "Désolé, vous n'êtes pas autorisé à faire ceci.", itemNoExist = "Désolé, l'objet que vous avez demandé n'a pas été trouvé ou n'existe pas.", cmdNoExist = "Désolé, cette commande n'a pas été trouvé ou n'existe pas.", plyNoExist = "Désolé, le joueur n'a pas été trouvé ou n'existe pas.", @@ -84,29 +82,29 @@ LANGUAGE = { dSold = "Vous avez vendu cette porte pour %s.", notOwner = "Vous n'êtes pas le propriétaire de ceci.", invalidArg = "Vous avez fourni une valeur non valide pour l'argument #%s.", - invalidFaction = "La faction que vous avez fourni n'a pu être trouvée.", - flagGive = "%s a donné à %s les flag's '%s'.", - flagGiveTitle = "Donner flag's", - flagGiveDesc = "Donner les flag's suivants à un joueur.", - flagTake = "%s a retiré à %s les flag's '%s'.", - flagTakeTitle = "Retirer flag's", - flagTakeDesc = "Retirer les flag's suivant à un joueur.", - flagNoMatch = "Vous devez avoir le ou les flag's \"%s\" pour réaliser cette action.", + flagGive = "%s a donné à %s les drapeaux \"%s\".", + flagGiveTitle = "Donner drapeaux", + flagGiveDesc = "Donner les drapeaux suivants à un joueur.", + flagTake = "%s a retiré les drapeaux \"%s\" à %s.", + flagTakeTitle = "Retirer drapeaux", + flagTakeDesc = "Retirer les drapeaux suivants à un joueur.", + flagNoMatch = "Vous devez avoir le ou les drapeaux \"%s\" pour réaliser cette action.", textAdded = "Vous avez ajouté un texte.", textRemoved = "Vous avez supprimé %s texte(s).", moneyTaken = "Vous avez trouvé %s.", businessPurchase = "Vous avez acheté %s pour %s.", businessSell = "Vous avez vendu %s pour %s.", - cChangeModel = "%s a modifié le modèle %s's par %s.", - cChangeName = "%s a modifié le nom %s's par %s.", - cChangeSkin = "%s a modifié le skin %s's par %s.", - cChangeGroups = "%s a modifié le groupe %s's \"%s\" par %s.", - cChangeFaction = "%s a modifié la faction %s par %s.", + cChangeModel = "%s a modifié le modèle de %s par \"%s\".", + cChangeName = "%s a modifié le nom roleplay de %s par \"%s\".", + cChangeSkin = "%s a modifié la peau (skin) de %s par \"%s\".", + cChangeGroups = "%s a modifié le bodygroup de %s avec (nom: %s, index: %s).", + cChangeFaction = "%s a modifié la faction de %s par \"%s\".", playerCharBelonging = "Cet objet appartient à un autre de vos personnages.", business = "Marché", - invalidFaction = "Vous avez fourni un nom de faction invalide.", - spawnAdd = "Vous avez ajouté un spawn pour %s.", - spawnDeleted = "Vous avez supprimé %s point(s) de spawn.", + invalidFaction = "La faction que vous avez fourni n'a pu être trouvée.", + limitFaction = "Cette faction est complète. Réessayez plus tard.", + spawnAdd = "Vous avez ajouté un point d'apparition pour %s.", + spawnDeleted = "Vous avez supprimé %s point(s) d'apparition.", someone = "Quelqu'un", rgnLookingAt = "Permettre à la personne que vous regardez de vous reconnaître.", rgnWhisper = "Permettre à ceux qui vous entendent chuchoter de vous reconnaître.", @@ -117,9 +115,9 @@ LANGUAGE = { wFormat = "%s chuchote \"%s\"", yFormat = "%s crie \"%s\"", sbOptions = "Cliquez pour voir les options de %s.", - spawnAdded = "Vous avez ajouté un spawn pour %s.", - whitelist = "%s a whitelist %s pour la faction %s.", - unwhitelist = "%s a unwhitelist %s pour la faction %s.", + spawnAdded = "Vous avez ajouté un point d'apparition pour %s.", + whitelist = "%s a ajouté à la liste blanche %s pour la faction %s.", + unwhitelist = "%s a retiré de la liste blanche %s pour la faction %s.", gettingUp = "Vous êtes maintenant debout...", wakingUp = "Vous avez repris conscience...", Weapons = "Armes", @@ -166,13 +164,13 @@ LANGUAGE = { charBan = "%s a banni le personnage %s.", charBanned = "Ce personnage est banni.", setMoney = "Vous avez défini l'argent de %s à %s.", - itemPriceInfo = "Vous pouvez acheter cet objet pour %s.\nVous pouvez vendre cet objet pour %s", + itemPriceInfo = "Vous pouvez acheter cet objet pour %s.\nVous pouvez vendre cet objet pour %s.", free = "Gratuit", vendorNoSellItems = "Il n'y a pas d'objet à vendre.", vendorNoBuyItems = "Il n'y a pas d'objet à acheter.", vendorSettings = "Modifications", vendorUseMoney = "Le PNJ peut utiliser de l'argent?", - vendorNoBubble = "Cacher la bulle du PNJ?", + vendorNoBubble = "Cacher la bulle du PNJ ?", mode = "Mode", price = "Prix", stock = "Stock", @@ -183,8 +181,8 @@ LANGUAGE = { maxStock = "Max stock", vendorFaction = "Modification faction", buy = "Achat", - vendorWelcome = "Bienvenue dans mon magasin, tout ce que je peux vous obtenir se trouve ici!", - vendorBye = "À bientôt!", + vendorWelcome = "Bienvenue dans mon magasin, tout ce que je peux vous obtenir se trouve ici !", + vendorBye = "À bientôt !", charSearching = "Vous êtes déjà à la recherche d'un autre personnage, veuillez attendre.", charUnBan = "%s a débanni le personnage %s.", charNotBanned = "Ce personnage n'est pas interdit.", @@ -192,21 +190,24 @@ LANGUAGE = { storPassRmv = "Vous avez supprimé le mot de passe de ce stockage.", storPassWrite = "Entrez le mot de passe.", wrongPassword = "Vous avez entré un mauvais mot de passe.", - cheapBlur = "Désactiver le flou? (Gain FPS)", + cheapBlur = "Désactiver le flou ? (Gain FPS)", quickSettings = "Paramètres rapides", vmSet = "Vous avez défini votre messagerie vocale.", vmRem = "Vous avez supprimé votre messagerie vocale.", - altLower = "Cacher les mains quand elles sont abaissées?", - noPerm = "Vous n'êtes pas autorisé à faire ceci.", + altLower = "Cacher les mains quand elles sont baissées ?", + noPerm = "Vous n'êtes pas autorisé à faire ceci.", youreDead = "Vous êtes mort", injMajor = "Il semble grièvement blessé.", injLittle = "Il semble blessé.", - toggleESP = "Act/Des ESP Admin", + toggleObserverTP = "Activer l'observation des téléportations", + toggleESP = "Activer l'ESP admin", + toggleESPAdvanced = "Mode avancé de l'ESP", chgName = "Changer de nom", chgNameDesc = "Entrez le nouveau nom du personnage ci-dessous.", - thirdpersonToggle = "Act/Des Vue 3E Personne", - thirdpersonClassic = "Utilisation classique 3E Personne", - equippedBag = "Le sac que vous avez déplacé contient un ou plusieurs objets.", + thirdpersonToggle = "Activer la troisième personne", + thirdpersonClassic = "Utiliser troisième personne classique", + thirdpersonConfig = "Configuration troisième personne", + equippedBag = "Les objets équipés ne peuvent pas être déplacés entre les inventaires.", useTip = "Utiliser l'objet.", equipTip = "Équiper l'objet.", unequipTip = "Déséquiper l'objet.", @@ -217,16 +218,50 @@ LANGUAGE = { salary = "Vous avez reçu votre salaire, %s.", noRecog = "Vous ne connaissez pas cette personne.", curTime = "L'heure et la date actuelle, %s.", - vendorEditor = "Modifications", + vendorEditor = "Édition du vendeur", edit = "Éditer", disable = "Désactiver", vendorPriceReq = "Entrez le nouveau prix pour cet objet.", vendorEditCurStock = "Modifier le stock actuel", you = "Vous", vendorSellScale = "Échelle de prix de vente", - vendorNoTrade = "Vous n'êtes pas en mesure d'échanger avec ce vendeur.", - vendorNoMoney = "Ce vendeur ne peut vous acheter cet objet, il n'a plus d'argent.", - vendorNoStock = "Ce vendeur n'a pas cet objet en stock.", - contentTitle = "NutScript Contenu manquant", - contentWarning = "Vous ne devez pas avoir le contenu NutScript. Cela peut entraîner certains dysfonctionnements.\nAimeriez-vous ouvrir la page du Workshop, pour avoir le contenu NutScript?" + vendorNoTrade = "Vous ne pouvez pas faire de commerce avec ce vendeur.", + vendorNoMoney = "Ce vendeur ne peut pas se payer cet article.", + vendorNoStock = "Ce vendeur n'a pas cet article en stock.", + contentTitle = "Contenu NutScript manquant", + contentWarning = "Vous n'avez pas monté le contenu NutScript. Cela peut entraîner l'absence de certaines fonctionnalités. L'adresse du contenu NutScript a été remplacée par celle de rebel1324.\nVoulez-vous ouvrir la page de l'atelier pour le contenu NutScript ?", + flags = "Drapeaux", + chooseTip = "Choisissez ce personnage pour jouer avec lui.", + deleteTip = "Supprimez ce personnage.", + moneyLeft = "Votre argent : ", + currentMoney = "Argent restant : ", + + -- 2018 patch + + ammoLoadAll = "Tout charger", + ammoLoadAmount = "Charger %s", + ammoLoadCustom = "Chargement...", + split = "Diviser", + splitHelp = "Saisissez un nombre pour diviser.", + splitHalf = "Diviser 1/2", + splitQuarter = "Diviser 1/4", + recognize = "Permettez à ce personnage de vous reconnaître.", + recognized = "Tu as donné ton identité à ce personnage.", + already_recognized = "Ce personnage vous connaît déjà.", + isTied = "Cette personne a été attachée.", + tying = "Attachement", + untying = "Détachement", + beingUntied = "Tu as été détaché.", + beingTied = "Tu as été attaché.", + sameOutfitCategory = "Vous portez déjà ce type de tenue.", + noBusiness = "Vous n'êtes pas autorisé à acheter quoi que ce soit pour le moment.", + panelRemoved = "Vous avez supprimé %s interfaces 3D.", + panelAdded = "Vous avez ajouté une interface 3D.", + itemOnGround = "Votre article a été placé sur le sol.", + forbiddenActionStorage = "Vous ne pouvez pas faire cette action avec un objet stocké.", + cantDropBagHasEquipped = "Vous ne pouvez pas déposer un sac qui a un objet équipé.", + + -- 2021 patch + lookToUseAt = "Vous devez regarder quelqu'un pour utiliser '@'.", + mustProvideString = "Vous devez fournir une chaîne de caractères pour la variable", } From 087cc8f5bc455388378c29c3bef7244b48eb4309 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Mon, 19 Apr 2021 22:53:29 +0300 Subject: [PATCH 10/50] While reviewing the commit, found another issue ent was not defined and as such always nil. Most likely a typo --- entities/weapons/nut_hands.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entities/weapons/nut_hands.lua b/entities/weapons/nut_hands.lua index 72b8ba31..c7b838ed 100644 --- a/entities/weapons/nut_hands.lua +++ b/entities/weapons/nut_hands.lua @@ -591,7 +591,7 @@ function SWEP:pickup(entity, trace) local max_force = CARRY_FORCE_LIMIT if (entity:GetClass() == "prop_ragdoll") then - self.dt.carried_rag = ent + self.dt.carried_rag = entity bone = trace.PhysicsBone max_force = 0 From b19e5ed3708674b836844215d00dd45b7c7a1df7 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Mon, 19 Apr 2021 22:55:44 +0300 Subject: [PATCH 11/50] Thank you SPURION, scoreboard fix --- plugins/scoreboard/derma/cl_scoreboard.lua | 28 ++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/plugins/scoreboard/derma/cl_scoreboard.lua b/plugins/scoreboard/derma/cl_scoreboard.lua index fd8a0e36..938b56ff 100644 --- a/plugins/scoreboard/derma/cl_scoreboard.lua +++ b/plugins/scoreboard/derma/cl_scoreboard.lua @@ -52,7 +52,7 @@ local PANEL = {} list:SetTall(28) list.Think = function(this) for k2, v2 in ipairs(team.GetPlayers(k)) do - if (!IsValid(v2.nutScoreSlot) or v2.nutScoreSlot:GetParent() ~= this) then + if (not IsValid(v2.nutScoreSlot) or v2.nutScoreSlot:GetParent() ~= this) then if (IsValid(v2.nutPlayerSlot)) then v2.nutPlayerSlot:SetParent(this) else @@ -85,24 +85,22 @@ local PANEL = {} local visible, amount - for k, v in ipairs(self.teams) do - visible, amount = v:IsVisible(), team.NumPlayers(k) + for faction, v in ipairs(self.teams) do + visible, amount = v:IsVisible(), team.NumPlayers(faction) if (visible and amount == 0) then v:SetVisible(false) self.layout:InvalidateLayout() - elseif (!visible and amount > 0) then + elseif (not visible and amount > 0) then v:SetVisible(true) end - - local faction = nut.faction.indices[k] - - if (amount != 0) then + + if (amount ~= 0) then v:SetVisible(hook.Run("ShowFactionInScoreboard", faction) ~= false or LocalPlayer():IsAdmin()) end end - for k, v in pairs(self.slots) do + for _, v in pairs(self.slots) do if (IsValid(v)) then v:update() end @@ -113,7 +111,7 @@ local PANEL = {} end function PANEL:addPlayer(client, parent) - if (!client:getChar() or !IsValid(parent)) then + if (not client:getChar() or not IsValid(parent)) then return end @@ -146,7 +144,7 @@ local PANEL = {} slot.model:SetTooltip(L("sbOptions", client:steamName())) timer.Simple(0, function() - if (!IsValid(slot)) then + if (not IsValid(slot)) then return end @@ -198,7 +196,7 @@ local PANEL = {} local oldTeam = client:Team() function slot:update() - if (!IsValid(client) or !client:getChar() or !self.character or self.character ~= client:getChar() or oldTeam ~= client:Team()) then + if (not IsValid(client) or not client:getChar() or not self.character or self.character ~= client:getChar() or oldTeam ~= client:Team()) then self:Remove() local i = 0 @@ -236,20 +234,20 @@ local PANEL = {} self.lastDesc = desc end - if (!IsValid(entity)) then + if (not IsValid(entity)) then return end if (self.lastModel ~= model or self.lastSkin ~= skin) then self.model:SetModel(client:GetModel(), client:GetSkin()) self.model:SetTooltip(L("sbOptions", client:steamName())) - + self.lastModel = model self.lastSkin = skin end timer.Simple(0, function() - if (!IsValid(entity) or !IsValid(client)) then + if (not IsValid(entity) or not IsValid(client)) then return end From 9eb6b8e07cafbf17e850b6ee5b47af0b087e17b9 Mon Sep 17 00:00:00 2001 From: VindoesCompooter <100soundsystem32@gmail.com> Date: Sun, 25 Apr 2021 10:25:48 +0100 Subject: [PATCH 12/50] global draw-over hook Lets you draw over every type of item at once. --- gamemode/core/derma/cl_inventory.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gamemode/core/derma/cl_inventory.lua b/gamemode/core/derma/cl_inventory.lua index 9d1ad015..b6a5ece6 100644 --- a/gamemode/core/derma/cl_inventory.lua +++ b/gamemode/core/derma/cl_inventory.lua @@ -102,6 +102,8 @@ function PANEL:PaintOver(w, h) if (itemTable and itemTable.paintOver) then local w, h = self:GetSize() + + hook.Run("ItemPaintOver", self, itemTable, w, h) itemTable.paintOver(self, itemTable, w, h) end From 809b9e02251538328c6e806b9d6e5552a63df667 Mon Sep 17 00:00:00 2001 From: VindoesCompooter <100soundsystem32@gmail.com> Date: Tue, 27 Apr 2021 07:11:49 +0100 Subject: [PATCH 13/50] Small fix Weren't able to paint if the item didnt have a .paintOver function --- gamemode/core/derma/cl_inventory.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamemode/core/derma/cl_inventory.lua b/gamemode/core/derma/cl_inventory.lua index b6a5ece6..1b3a830d 100644 --- a/gamemode/core/derma/cl_inventory.lua +++ b/gamemode/core/derma/cl_inventory.lua @@ -102,11 +102,11 @@ function PANEL:PaintOver(w, h) if (itemTable and itemTable.paintOver) then local w, h = self:GetSize() - - hook.Run("ItemPaintOver", self, itemTable, w, h) itemTable.paintOver(self, itemTable, w, h) end + + hook.Run("ItemPaintOver", self, itemTable, w, h) end function PANEL:PaintBehind(w, h) From 36c11bb3cdbba0aa16ad12ca631c2aec992ec055 Mon Sep 17 00:00:00 2001 From: baratoxis <33399712+baratoxis@users.noreply.github.com> Date: Wed, 28 Apr 2021 20:15:26 +0100 Subject: [PATCH 14/50] Minor Language Adjustments & Credits added (#60) --- gamemode/languages/sh_spanish.lua | 39 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/gamemode/languages/sh_spanish.lua b/gamemode/languages/sh_spanish.lua index 6e77f2da..3b5c7be6 100644 --- a/gamemode/languages/sh_spanish.lua +++ b/gamemode/languages/sh_spanish.lua @@ -1,5 +1,6 @@ -NAME = "Español" ---//Contact DasBarata#2411 if you have any translation change suggestion\\---- - +---//Translation made by DasBarata#2411 & CVAROG#7222\\---- +---//Contact DasBarata#2411 if you have any translation change suggestion\\---- +NAME = "Español" LANGUAGE = { loading = "Cargando", dbError = "Fallo de conexión con la Base de Datos", @@ -10,7 +11,7 @@ LANGUAGE = { load = "Cargar", loadTip = "Escoge un personaje previamente creado con el que jugar.", leave = "Abandonar", - leaveTip = "Abandona el servidor actual.", + leaveTip = "Abandonar el servidor.", ["return"] = "Volver", returnTip = "Vuelve al menú anterior.", name = "Nombre", @@ -54,24 +55,24 @@ LANGUAGE = { drop = "Tirar", dropTip = "Tira el objeto desde tu inventario.", take = "Coger", - takeTip = "Coge éste objeto y lo coloca en tu inventario.", + takeTip = "Coge éste objeto y colocarlo en tu inventario.", dTitle = "Puerta sin propietario", dTitleOwned = "Puerta comprada", - dIsNotOwnable = "Está puerta no puede se poseer.", + dIsNotOwnable = "Está puerta no se puede poseer.", dIsOwnable = "Puedes comprar ésta puerta pulsando F2.", dMadeUnownable = "Has hecho ésta puerta 'No poseíble'.", dMadeOwnable = "Has hecho ésta puerta 'Poseíble'.", dNotAllowedToOwn = "No tienes permiso a poseer ésta puerta.", - dSetDisabled = "Has hecho ésta puerta 'Dehabilitada'.", - dSetNotDisabled = "Has hecho ésta puerta 'Habilitada'.", + dSetDisabled = "Has hecho que ésta puerta este 'Dehabilitada'.", + dSetNotDisabled = "Has hecho que ésta puerta este 'Habilitada'.", dSetHidden = "Has hecho que ésta puerta esté oculta.", dSetNotHidden = "Has hecho que ésta puerta no esté oculta.", - dSetParentDoor = "Has establecido ésta puerta como tu puerta madre.", - dCanNotSetAsChild = "No puedes establecer la puerta madre como puerta hija.", - dAddChildDoor = "Has añadido ésta puerta como puerta hija.", - dRemoveChildren = "Has eliminado todas las puertas hijas de ésta puerta.", - dRemoveChildDoor = "Has eliminado ésta puerta como puerta hija.", - dNoParentDoor = "No tienes una puerta madre establecida.", + dSetParentDoor = "Has establecido ésta puerta como tu puerta principal.", + dCanNotSetAsChild = "No puedes establecer la puerta principal como puerta secundaria.", + dAddChildDoor = "Has añadido ésta puerta como puerta secundaria.", + dRemoveChildren = "Has eliminado todas las puertas secundarias de ésta puerta.", + dRemoveChildDoor = "Has eliminado ésta puerta como puerta secundaria.", + dNoParentDoor = "No tienes una puerta principal establecida.", dOwnedBy = "Ésta puerta está poseída por %s.", dConfigName = "Puertas", dSetFaction = "Ésta puerta ahora pertenece a la facción %s.", @@ -111,7 +112,7 @@ LANGUAGE = { icFormat = "%s dice \"%s\"", rollFormat = "%s ha tirado los dados y ha sacado un %s.", wFormat = "%s susurra \"%s\"", - yFormat = "%s grita \"%s\"", + yFormat = "%s gritar \"%s\"", sbOptions = "Haz clic para ver las opciones de %s.", spawnAdded = "Has añadido punto de aparición de %s.", whitelist = "%s ha metido a %s en la 'whitelist' de la facción %s.", @@ -180,7 +181,7 @@ LANGUAGE = { buy = "Comprar", vendorWelcome = "Bienvenid@ a mi tienda, ¿qué puedo hacer por usted?", vendorBye = "¡Vuelva pronto!", - charSearching = "You are already searching for another character, please wait.", + charSearching = "Ya está buscando a otro personaje, por favor espere.", charUnBan = "%s ha perdonado la expulsión a %s.", charNotBanned = "Éste personaje no está expulsado.", storPass = "Has establecido la contraseña de éste depósito como %s.", @@ -226,11 +227,11 @@ LANGUAGE = { thirdpersonConfig = "Configuración de cámara en tercera persona", vendorSellScale = "Escala de precios de venta", - vendorNoTrade = "No puede comprar a este vendedor.", - vendorNoMoney = "Este vendedor no puede pagar ese artículo.", - vendorNoStock = "Este vendedor no tiene ese artículo en stock.", + vendorNoTrade = "No puedes comprar a este vendedor.", + vendorNoMoney = "Este vendedor no puede pagar este artículo.", + vendorNoStock = "Este vendedor no tiene este artículo en stock.", contentTitle = "Content del NutScript Ausent", - contentWarning = "No tienes el contenido de NutScript montado. Esto puede resultar en la falta de ciertas funciones.\nUtilice el contenido de Nutscript de Rebel1324.\n¿Le gustaría abrir la página del Workshop para el contenido de NutScript?", + contentWarning = "No tienes el contenido de NutScript montado. Esto puede probocar ciertas fallas en las funciones.\nUtilice el contenido de Nutscript de Rebel1324.\n¿Le gustaría abrir la página del Workshop para el contenido de NutScript?", flags = "Flags", chooseTip = "Elige este personaje para jugar.", deleteTip = "Eliminar este personaje.", From 13578f4d183cf32781ac2ce463ba309a22c09f4f Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 2 May 2021 13:36:28 +0200 Subject: [PATCH 15/50] Fixed the indicator display when a player is in act Under some conditions, a player in act doesn't allow the chat indicator to be displayed correctly. --- plugins/typing.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/typing.lua b/plugins/typing.lua index ee2a66b8..ba76a9e8 100644 --- a/plugins/typing.lua +++ b/plugins/typing.lua @@ -31,13 +31,15 @@ if (CLIENT) then data.filter = localPlayer for k, v in ipairs(player.GetAll()) do + local isActing = v:getNetVar("actAng") + if ( v ~= localPlayer and v:getNetVar("typing") and - v:GetMoveType() == MOVETYPE_WALK + (v:GetMoveType() == MOVETYPE_WALK or isActing) ) then data.endpos = v:EyePos() - if (util.TraceLine(data).Entity ~= v) then continue end + if (util.TraceLine(data).Entity ~= v and not isActing) then continue end local position = v:GetPos() alpha = (1 - (ourPos:DistToSqr(position) / 65536)) * 255 if (alpha <= 0) then continue end From a7a6967d33e078da961006ebf2ad862d337ea1ff Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sat, 8 May 2021 12:51:26 +0200 Subject: [PATCH 16/50] Fix some spacing issues Fixed some small spacing issues with my GLua linter. --- plugins/newvoice.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/newvoice.lua b/plugins/newvoice.lua index 253b6b36..8f605c8f 100644 --- a/plugins/newvoice.lua +++ b/plugins/newvoice.lua @@ -30,7 +30,7 @@ if (CLIENT) then end function PANEL:Setup(client) - self.client= client + self.client = client self.name = hook.Run("ShouldAllowScoreboardOverride", client, "name") and hook.Run("GetDisplayedName", client) or client:Nick() self.LabelName:SetText(self.name) self:InvalidateLayout() @@ -121,7 +121,7 @@ if (CLIENT) then if (IsValid(g_VoicePanelList)) then g_VoicePanelList:Remove() end - + g_VoicePanelList = vgui.Create("DPanel") g_VoicePanelList:ParentToHUD() From 3fb132951ce6891dad3c42774cbd4ad4d3f55150 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sat, 8 May 2021 12:59:51 +0200 Subject: [PATCH 17/50] Do not show the voice panel if allowVoice is disabled This will prevent confusion for players who think that voice communication is active when it isn't. --- plugins/newvoice.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/newvoice.lua b/plugins/newvoice.lua index 8f605c8f..b4b66184 100644 --- a/plugins/newvoice.lua +++ b/plugins/newvoice.lua @@ -73,7 +73,7 @@ if (CLIENT) then vgui.Register("VoicePanel", PANEL, "DPanel") function PLUGIN:PlayerStartVoice(client) - if (!IsValid(g_VoicePanelList)) then return end + if (!IsValid(g_VoicePanelList) or !nut.config.get("allowVoice", false)) then return end hook.Run("PlayerEndVoice", client) From 439e1739bdbd8feef2f08b85e2d5b0ac99ecdad5 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sat, 8 May 2021 13:02:17 +0200 Subject: [PATCH 18/50] Replace some color objects into Gmod constants This is a micro-micro optimization. --- plugins/newvoice.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/newvoice.lua b/plugins/newvoice.lua index b4b66184..50dbbe81 100644 --- a/plugins/newvoice.lua +++ b/plugins/newvoice.lua @@ -11,7 +11,7 @@ if (CLIENT) then hi:SetFont("nutIconsMedium") hi:Dock(LEFT) hi:DockMargin(8, 0, 8, 0) - hi:SetTextColor(Color(255, 255, 255, 255)) + hi:SetTextColor(color_white) hi:SetText("i") hi:SetWide(30) @@ -19,7 +19,7 @@ if (CLIENT) then self.LabelName:SetFont("nutMediumFont") self.LabelName:Dock(FILL) self.LabelName:DockMargin(0, 0, 0, 0) - self.LabelName:SetTextColor(Color(255, 255, 255, 255)) + self.LabelName:SetTextColor(color_white) self.Color = color_transparent From f942b2b0a95f07e6a46ff7905bb3cb62093b7a77 Mon Sep 17 00:00:00 2001 From: VindoesCompooter <100soundsystem32@gmail.com> Date: Sat, 8 May 2021 12:37:58 +0100 Subject: [PATCH 19/50] give power to the canitembetransferred hook Fix it so that the canitembetransferred hook can actually notify the player of a reason, as well as allow it to see the transferring player. --- plugins/gridinv/sv_access_rules.lua | 2 +- plugins/gridinv/sv_transfer.lua | 8 +++----- plugins/vendor/sv_hooks.lua | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/gridinv/sv_access_rules.lua b/plugins/gridinv/sv_access_rules.lua index 6e49bae4..050b974a 100644 --- a/plugins/gridinv/sv_access_rules.lua +++ b/plugins/gridinv/sv_access_rules.lua @@ -44,7 +44,7 @@ local function CanNotTransferBagIfNestedItemCanNotBe(inventory, action, context) for _, item in pairs(bagInventory:getItems()) do local canTransferItem, reason = - hook.Run("CanItemBeTransfered", item, bagInventory, bagInventory) + hook.Run("CanItemBeTransfered", item, bagInventory, bagInventory, context.client) if (canTransferItem == false) then return false, reason or "An item in the bag cannot be transfered" end diff --git a/plugins/gridinv/sv_transfer.lua b/plugins/gridinv/sv_transfer.lua index bb7989ff..5b90a07d 100644 --- a/plugins/gridinv/sv_transfer.lua +++ b/plugins/gridinv/sv_transfer.lua @@ -12,11 +12,9 @@ function PLUGIN:HandleItemTransferRequest(client, itemID, x, y, invID) return end -- Make sure the item is permitted to move between the two inventories. - if ( - hook.Run("CanItemBeTransfered", item, oldInventory, inventory) == false - ) then - return - end + local status,reason = hook.Run("CanItemBeTransfered", item, oldInventory, inventory, client) + + if (status == false) then client:notify(reason or "You can't do that right now.") return end local context = { client = client, diff --git a/plugins/vendor/sv_hooks.lua b/plugins/vendor/sv_hooks.lua index 15eab1f6..873397b3 100644 --- a/plugins/vendor/sv_hooks.lua +++ b/plugins/vendor/sv_hooks.lua @@ -118,7 +118,7 @@ function PLUGIN:VendorTradeAttempt( return end - local canTransferItem, reason = hook.Run("CanItemBeTransfered", item, inventory, VENDOR_INVENTORY_MEASURE) + local canTransferItem, reason = hook.Run("CanItemBeTransfered", item, inventory, VENDOR_INVENTORY_MEASURE, client) if (canTransferItem == false) then client:notifyLocalized(reason or "vendorError") From c534248d9e4d89dd5d64fa006db4ebf6089834aa Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sat, 8 May 2021 13:44:02 +0200 Subject: [PATCH 20/50] Remove trailing whitespace Let's make my linter happy. --- plugins/area/sh_plugin.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/area/sh_plugin.lua b/plugins/area/sh_plugin.lua index 48403922..00fd0413 100644 --- a/plugins/area/sh_plugin.lua +++ b/plugins/area/sh_plugin.lua @@ -6,7 +6,7 @@ PLUGIN.areaTable = PLUGIN.areaTable or {} nut.area = nut.area or {} ALWAYS_RAISED["nut_areahelper"] = true -nut.config.add("areaFontSize", 26, "The size of the font of Area Display.", +nut.config.add("areaFontSize", 26, "The size of the font of Area Display.", function(oldValue, newValue) if (CLIENT) then hook.Run( @@ -133,7 +133,7 @@ if (SERVER) then table.insert(PLUGIN.areaTable, { name = name, minVector = minVector, - maxVector = maxVector, + maxVector = maxVector, desc = desc or "", }) @@ -222,7 +222,7 @@ else panel:SetTall(30) frame:AddItem(panel) end - + function nut.area.openAreaManager() local frame = vgui.Create("DFrame") frame:SetSize(400, 300) @@ -315,9 +315,9 @@ else function PLUGIN:HUDPaint() -- values if ((hook.Run("CanDisplayArea") == false) or (dieTrigger and dieTimer < RealTime() and dieAlpha <= 1)) then - return + return end - + ft = FrameTime() w, h = ScrW(), ScrH() dsx, dsy = 0 @@ -325,7 +325,7 @@ else local rTime = RealTime() surface.SetFont("nutAreaDisplay") - local sx, sy = surface.GetTextSize(dispString) + local sx, sy = surface.GetTextSize(dispString) -- Number of characters to display. local maxDisplay = math.Round(rTime*speed - powTime) @@ -368,7 +368,7 @@ else (dieTrigger and dieTimer < RealTime()) and dieAlpha or flipTable[i][2]) ) - -- next + -- next dsx = dsx + tx*scale end From aab8ab6a097426c20b2206c2b2ae1fd225846719 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sat, 8 May 2021 13:48:05 +0200 Subject: [PATCH 21/50] Some cleanup - Remove unused variables - Whitespace before/after operators --- plugins/area/sh_plugin.lua | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/plugins/area/sh_plugin.lua b/plugins/area/sh_plugin.lua index 00fd0413..9cd4b34b 100644 --- a/plugins/area/sh_plugin.lua +++ b/plugins/area/sh_plugin.lua @@ -174,7 +174,7 @@ if (SERVER) then if (areaData) then local min, max = areaData.maxVector, areaData.minVector - client:SetPos(min + (max - min)/2) + client:SetPos(min + (max - min) / 2) end end) @@ -259,7 +259,6 @@ else -- draw matrix string. local function drawMatrixString(str, font, x, y, scale, angle, color) surface.SetFont(font) - local tx, ty = surface.GetTextSize(str) local matrix = Matrix() matrix:Translate(Vector(x, y, 1)) @@ -284,10 +283,8 @@ else -- local scale = 0 local scale = 0 local flipTable = {} - local powTime = RealTime()*speed + local powTime = RealTime() * speed local curChar = 0 - local mathsin = math.sin - local mathcos = math.cos local dieTrigger = false local dieTimer = RealTime() local dieAlpha = 0 @@ -301,7 +298,7 @@ else scale = targetScale * .5 flipTable = {} - powTime = RealTime()*speed + powTime = RealTime() * speed curChar = 0 dieTrigger = false dieTimer = RealTime() @@ -328,15 +325,15 @@ else local sx, sy = surface.GetTextSize(dispString) -- Number of characters to display. - local maxDisplay = math.Round(rTime*speed - powTime) + local maxDisplay = math.Round(rTime * speed - powTime) -- resize if it's too big. - while (sx and sx*targetScale > w*.8) do + while (sx and sx * targetScale > w * .8) do targetScale = targetScale * .9 end -- scale lerp - scale = Lerp(ft*1, scale, targetScale) + scale = Lerp(ft * 1, scale, targetScale) -- change event if (maxDisplay ~= curChar and curChar < strEnd) then @@ -352,16 +349,16 @@ else flipTable[i] = flipTable[i] or {} flipTable[i][1] = flipTable[i][1] or .1 flipTable[i][2] = flipTable[i][2] or 0 - flipTable[i][1] = Lerp(ft*4, flipTable[i][1], scale) - flipTable[i][2] = Lerp(ft*4, flipTable[i][2], 255) + flipTable[i][1] = Lerp(ft * 4, flipTable[i][1], scale) + flipTable[i][2] = Lerp(ft * 4, flipTable[i][2], 255) -- draw character. local char = string.utf8sub(dispString, i, i) - local tx, ty = surface.GetTextSize(char) + local tx = surface.GetTextSize(char) drawMatrixString(char, "nutAreaDisplay", - math.Round(w/2 + dsx - (sx or 0)*scale/2), - math.Round(h/3*1 - (sy or 0)*scale/2), + math.Round(w / 2 + dsx - (sx or 0) * scale / 2), + math.Round(h / 3 - (sy or 0) * scale / 2), Vector(Format("%.2f", flipTable[i][1]), Format("%.2f", scale), 1), nil, Color(255, 255, 255, @@ -369,7 +366,7 @@ else ) -- next - dsx = dsx + tx*scale + dsx = dsx + tx * scale end if (maxDisplay >= strEnd) then @@ -378,7 +375,7 @@ else dieTimer = RealTime() + 2 else if (dieTimer < RealTime()) then - dieAlpha = Lerp(ft*4, dieAlpha, 0) + dieAlpha = Lerp(ft * 4, dieAlpha, 0) end end end From c35177edd7e03fc415db2f953ccab1a95c828b83 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sat, 8 May 2021 13:52:01 +0200 Subject: [PATCH 22/50] Fixed meta:isInArea not working properly since its creation. Introduced in https://github.com/NutScript/NutScript/commit/2c6cbebb38b64a136d4fcf017686d4b0b1148d58#diff-42bf01e4eea016ea350ced2c4597400beaa3bfee59b00e36af7bccb9554d4593 Traceback : [ERROR] gamemodes/nutscript/plugins/area/sh_plugin.lua:47: attempt to index global 'v' (a nil value) 1. isInArea - gamemodes/nutscript/plugins/area/sh_plugin.lua:47 2. unknown - lua_run:1 --- plugins/area/sh_plugin.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/area/sh_plugin.lua b/plugins/area/sh_plugin.lua index 9cd4b34b..13b24704 100644 --- a/plugins/area/sh_plugin.lua +++ b/plugins/area/sh_plugin.lua @@ -44,7 +44,7 @@ if (SERVER) then return false, "Area you specified is not valid." end - local char = v:getChar() + local char = self:getChar() if (!char) then return false, "Your character is not valid." From 67942698ee1f31bb99f2e5516cbb97a251d070ee Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Sun, 9 May 2021 10:17:00 +0300 Subject: [PATCH 23/50] Add font scaling This allows fonts that are too large for the UI to be adjusted --- gamemode/config/sh_config.lua | 5 +++ gamemode/core/derma/cl_inventory.lua | 16 ++++++--- gamemode/core/hooks/cl_hooks.lua | 54 ++++++++++++++-------------- 3 files changed, 43 insertions(+), 32 deletions(-) diff --git a/gamemode/config/sh_config.lua b/gamemode/config/sh_config.lua index daf3b332..957cd822 100644 --- a/gamemode/config/sh_config.lua +++ b/gamemode/config/sh_config.lua @@ -29,6 +29,11 @@ nut.config.add("genericFont", "Segoe UI", "The font used to display generic text hook.Run("LoadNutFonts", nut.config.get("font"), newValue) end end, {category = "appearance"}) +nut.config.add("fontScale", 1.0, "The scale for the font.", function(oldValue, newValue) + if (CLIENT) then + hook.Run("LoadNutFonts", nut.config.get("font"), nut.config.get("genericFont")) + end +end, { form = "Float", data = {min = 0.1, max = 2.0}, category = "appearance"}) nut.config.add("chatRange", 280, "The maximum distance a person's IC chat message goes to.", nil, { form = "Float", diff --git a/gamemode/core/derma/cl_inventory.lua b/gamemode/core/derma/cl_inventory.lua index 9d1ad015..4abb043e 100644 --- a/gamemode/core/derma/cl_inventory.lua +++ b/gamemode/core/derma/cl_inventory.lua @@ -34,6 +34,8 @@ function PANEL:setItemType(itemTypeOrID) if (isnumber(itemTypeOrID)) then item = nut.item.instances[itemTypeOrID] self.itemID = itemTypeOrID + else + self.itemType = itemTypeOrID end assert(item, "invalid item type or ID "..tostring(item)) @@ -97,9 +99,13 @@ function PANEL:Init() self:SetSize(NS_ICON_SIZE, NS_ICON_SIZE) end +--[[ function PANEL:Think() + self.itemTable = nut.item.instances[self.itemID] + self:updateTooltip() +end ]] + function PANEL:PaintOver(w, h) local itemTable = nut.item.instances[self.itemID] - if (itemTable and itemTable.paintOver) then local w, h = self:GetSize() @@ -308,20 +314,20 @@ hook.Add("CreateMenuButtons", "nutInventory", function(tabs) local childPanels = inventory:show(mainPanel) nut.gui["inv"..inventory:getID()] = childPanels table.insert(sortPanels, childPanels) - + totalSize.x = totalSize.x + childPanels:GetWide() + margin totalSize.y = math.max(totalSize.y, childPanels:GetTall()) end end - + local px, py, pw, ph = mainPanel:GetBounds() - local x, y = px + pw/2 - totalSize.x / 2, py + ph/2 + local x, y = px + pw/2 - totalSize.x / 2, py + ph/2 for _, panel in pairs(sortPanels) do panel:ShowCloseButton(true) panel:SetPos(x, y - panel:GetTall()/2) x = x + panel:GetWide() + margin end - + hook.Add("PostRenderVGUI", mainPanel, function() hook.Run("PostDrawInventory", mainPanel) end) diff --git a/gamemode/core/hooks/cl_hooks.lua b/gamemode/core/hooks/cl_hooks.lua index e4359592..633a900f 100644 --- a/gamemode/core/hooks/cl_hooks.lua +++ b/gamemode/core/hooks/cl_hooks.lua @@ -1,6 +1,7 @@ function GM:LoadNutFonts(font, genericFont) local oldFont, oldGenericFont = font, genericFont - + local scale = math.Round(nut.config.get("fontScale", 1), 2) + print(ScreenScale(14) * scale, ScreenScale(14)) surface.CreateFont("nut3D2DFont", { font = font, size = 2048, @@ -10,28 +11,28 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutTitleFont", { font = font, - size = ScreenScale(30), + size = ScreenScale(30) * scale, extended = true, weight = 1000 }) surface.CreateFont("nutSubTitleFont", { font = font, - size = ScreenScale(18), + size = ScreenScale(18) * scale, extended = true, weight = 500 }) surface.CreateFont("nutMenuButtonFont", { font = font, - size = ScreenScale(14), + size = ScreenScale(14) * scale, extended = true, weight = 1000 }) surface.CreateFont("nutMenuButtonLightFont", { font = font, - size = ScreenScale(14), + size = ScreenScale(14) * scale, extended = true, weight = 200 }) @@ -45,21 +46,21 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutDynFontSmall", { font = font, - size = ScreenScale(22), + size = ScreenScale(22) * scale, extended = true, weight = 1000 }) surface.CreateFont("nutDynFontMedium", { font = font, - size = ScreenScale(28), + size = ScreenScale(28) * scale, extended = true, weight = 1000 }) surface.CreateFont("nutDynFontBig", { font = font, - size = ScreenScale(48), + size = ScreenScale(48) * scale, extended = true, weight = 1000 }) @@ -69,63 +70,63 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutCleanTitleFont", { font = font, - size = 200, + size = 200 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutHugeFont", { font = font, - size = 72, + size = 72 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutBigFont", { font = font, - size = 36, + size = 36 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutMediumFont", { font = font, - size = 25, + size = 25 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutMediumLightFont", { font = font, - size = 25, + size = 25 * scale, extended = true, weight = 200 }) surface.CreateFont("nutGenericFont", { font = font, - size = 20, + size = 20 * scale, extended = true, weight = 1000 }) surface.CreateFont("nutGenericLightFont", { font = font, - size = 20, + size = 20 * scale, extended = true, weight = 500 }) surface.CreateFont("nutChatFont", { font = font, - size = math.max(ScreenScale(7), 17), + size = math.max(ScreenScale(7), 17) * scale, extended = true, weight = 200 }) surface.CreateFont("nutChatFontItalics", { font = font, - size = math.max(ScreenScale(7), 17), + size = math.max(ScreenScale(7), 17) * scale, extended = true, weight = 200, italic = true @@ -133,21 +134,21 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutChatFontBold", { font = font, - size = math.max(ScreenScale(7), 17), + size = math.max(ScreenScale(7), 17) * scale, extended = true, weight = 800, }) surface.CreateFont("nutSmallFont", { font = font, - size = math.max(ScreenScale(6), 17), + size = math.max(ScreenScale(6), 17) * scale, extended = true, weight = 500 }) surface.CreateFont("nutItemDescFont", { font = font, - size = math.max(ScreenScale(6), 17), + size = math.max(ScreenScale(6), 17) * scale, extended = true, shadow = true, weight = 500 @@ -155,7 +156,7 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutSmallBoldFont", { font = font, - size = math.max(ScreenScale(8), 20), + size = math.max(ScreenScale(8), 20) * scale, extended = true, weight = 800 }) @@ -163,7 +164,7 @@ function GM:LoadNutFonts(font, genericFont) surface.CreateFont("nutItemBoldFont", { font = font, shadow = true, - size = math.max(ScreenScale(8), 20), + size = math.max(ScreenScale(8), 20) * scale, extended = true, weight = 800 }) @@ -286,7 +287,6 @@ end function GM:CharacterListLoaded() 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") @@ -345,7 +345,7 @@ function GM:CalcView(client, origin, angles, fov) view.origin = data.Pos view.angles = data.Ang end - + return view end end @@ -387,7 +387,7 @@ end function GM:PlayerBindPress(client, bind, pressed) bind = bind:lower() - + if ((bind:find("use") or bind:find("attack")) and pressed) then local menu, callback = nut.menu.getActiveMenu() @@ -440,7 +440,7 @@ function GM:ItemShowEntityMenu(entity) itemTable.entity = entity if (input.IsShiftDown()) then - callback("take") + callback("take") end for k, v in SortedPairs(itemTable.functions) do @@ -505,7 +505,7 @@ function GM:SetupQuickMenu(menu) local button = menu:addCheck(name, function(panel) panel.checked = true - + if (IsValid(current)) then if (current == panel) then return From 5968937aee0bd6feb9b3ebae5458cb7947fc80bd Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Sun, 9 May 2021 10:17:33 +0300 Subject: [PATCH 24/50] Add GetDefaultCharDesc Much like GetDefaultCharName --- gamemode/core/hooks/sh_hooks.lua | 21 +++++++++++++------ plugins/area/sh_plugin.lua | 14 ++++++------- .../gridinv/plugins/gridinvui/sh_plugin.lua | 2 +- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/gamemode/core/hooks/sh_hooks.lua b/gamemode/core/hooks/sh_hooks.lua index df8dbdad..aa94c1e1 100644 --- a/gamemode/core/hooks/sh_hooks.lua +++ b/gamemode/core/hooks/sh_hooks.lua @@ -214,7 +214,7 @@ end function GM:CalcMainActivity(client, velocity) client.CalcIdeal = ACT_MP_STAND_IDLE - + oldCalcSeqOverride = client.CalcSeqOverride client.CalcSeqOverride = -1 @@ -270,6 +270,15 @@ function GM:GetDefaultCharName(client, faction) end end +function GM:GetDefaultCharDesc(client, faction) + local info = nut.faction.indices[faction] + + if (info and info.onGetDefaultDesc) then + return info:onGetDefaultDesc(client) + end +end + + function GM:CanPlayerUseChar(client, char) local banned = char:getData("banned") @@ -301,7 +310,7 @@ function GM:CheckFactionLimitReached(faction, character, client) -- By default, the limit is the number of players allowed in that faction. local maxPlayers = faction.limit - + -- If some number less than 1, treat it as a percentage of the player count. if (faction.limit < 1) then maxPlayers = math.Round(#player.GetAll() * faction.limit) @@ -326,7 +335,7 @@ function GM:PhysgunPickup(client, entity) if (client:IsSuperAdmin()) then return true end - + if (client:IsAdmin() and !(entity:IsPlayer() and entity:IsSuperAdmin())) then return true end @@ -364,8 +373,8 @@ function GM:Move(client, moveData) ms = ratio end - moveData:SetForwardSpeed(mf * speed) - moveData:SetSideSpeed(ms * speed) + moveData:SetForwardSpeed(mf * speed) + moveData:SetSideSpeed(ms * speed) end end end @@ -373,7 +382,7 @@ end function GM:CanItemBeTransfered(itemObject, curInv, inventory) if (itemObject.onCanBeTransfered) then local itemHook = itemObject:onCanBeTransfered(curInv, inventory) - + return (itemHook ~= false) end end diff --git a/plugins/area/sh_plugin.lua b/plugins/area/sh_plugin.lua index 48403922..00fd0413 100644 --- a/plugins/area/sh_plugin.lua +++ b/plugins/area/sh_plugin.lua @@ -6,7 +6,7 @@ PLUGIN.areaTable = PLUGIN.areaTable or {} nut.area = nut.area or {} ALWAYS_RAISED["nut_areahelper"] = true -nut.config.add("areaFontSize", 26, "The size of the font of Area Display.", +nut.config.add("areaFontSize", 26, "The size of the font of Area Display.", function(oldValue, newValue) if (CLIENT) then hook.Run( @@ -133,7 +133,7 @@ if (SERVER) then table.insert(PLUGIN.areaTable, { name = name, minVector = minVector, - maxVector = maxVector, + maxVector = maxVector, desc = desc or "", }) @@ -222,7 +222,7 @@ else panel:SetTall(30) frame:AddItem(panel) end - + function nut.area.openAreaManager() local frame = vgui.Create("DFrame") frame:SetSize(400, 300) @@ -315,9 +315,9 @@ else function PLUGIN:HUDPaint() -- values if ((hook.Run("CanDisplayArea") == false) or (dieTrigger and dieTimer < RealTime() and dieAlpha <= 1)) then - return + return end - + ft = FrameTime() w, h = ScrW(), ScrH() dsx, dsy = 0 @@ -325,7 +325,7 @@ else local rTime = RealTime() surface.SetFont("nutAreaDisplay") - local sx, sy = surface.GetTextSize(dispString) + local sx, sy = surface.GetTextSize(dispString) -- Number of characters to display. local maxDisplay = math.Round(rTime*speed - powTime) @@ -368,7 +368,7 @@ else (dieTrigger and dieTimer < RealTime()) and dieAlpha or flipTable[i][2]) ) - -- next + -- next dsx = dsx + tx*scale end diff --git a/plugins/gridinv/plugins/gridinvui/sh_plugin.lua b/plugins/gridinv/plugins/gridinvui/sh_plugin.lua index 8d8cbc2e..5082602b 100644 --- a/plugins/gridinv/plugins/gridinvui/sh_plugin.lua +++ b/plugins/gridinv/plugins/gridinvui/sh_plugin.lua @@ -13,7 +13,7 @@ if (CLIENT) then local panel = vgui.Create("nutGridInventory", parent) panel:setInventory(inventory) panel:Center() - + return panel end From 2c6dbad786d0863d4e4104cd4e158966ae275ec2 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Sun, 9 May 2021 10:17:49 +0300 Subject: [PATCH 25/50] Update nut_hands.lua --- entities/weapons/nut_hands.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entities/weapons/nut_hands.lua b/entities/weapons/nut_hands.lua index c7b838ed..e3809b48 100644 --- a/entities/weapons/nut_hands.lua +++ b/entities/weapons/nut_hands.lua @@ -77,7 +77,7 @@ PLAYER_PICKUP_RANGE = 200 with prop pushing. CARRY_STRENGTH_GOD: 0 - You can push player with prop on this strength levle. the grabbing never fails. - Try this if you're playing with very trustful community. + Try this if you're playing with very trustful community. ]]-- CARRY_FORCE_LIMIT = CARRY_FORCE_LEVEL[CARRY_STRENGTH_CHAD] -- default strength level is CHAD. @@ -506,7 +506,7 @@ function SWEP:doPickup(throw, entity, trace) -- increase refire to make rags easier to drag --self.Weapon:SetNextSecondaryFire(CurTime() + 0.04) end - + if (IsValid(phys)) then self:dragObject(phys, pdir, 6000, is_ragdoll) return From 48a6c5f6b843029dcbb2586f149fa5a1dd6b4532 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Sun, 9 May 2021 10:51:39 +0300 Subject: [PATCH 26/50] formatting --- gamemode/config/sh_config.lua | 7 ++++++- gamemode/core/hooks/cl_hooks.lua | 11 ++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gamemode/config/sh_config.lua b/gamemode/config/sh_config.lua index 957cd822..4a73606e 100644 --- a/gamemode/config/sh_config.lua +++ b/gamemode/config/sh_config.lua @@ -29,11 +29,16 @@ nut.config.add("genericFont", "Segoe UI", "The font used to display generic text hook.Run("LoadNutFonts", nut.config.get("font"), newValue) end end, {category = "appearance"}) + nut.config.add("fontScale", 1.0, "The scale for the font.", function(oldValue, newValue) if (CLIENT) then hook.Run("LoadNutFonts", nut.config.get("font"), nut.config.get("genericFont")) end -end, { form = "Float", data = {min = 0.1, max = 2.0}, category = "appearance"}) +end, { + form = "Float", + data = {min = 0.1, max = 2.0}, + category = "appearance" +}) nut.config.add("chatRange", 280, "The maximum distance a person's IC chat message goes to.", nil, { form = "Float", diff --git a/gamemode/core/hooks/cl_hooks.lua b/gamemode/core/hooks/cl_hooks.lua index 633a900f..ce0d3e0f 100644 --- a/gamemode/core/hooks/cl_hooks.lua +++ b/gamemode/core/hooks/cl_hooks.lua @@ -1,7 +1,6 @@ function GM:LoadNutFonts(font, genericFont) local oldFont, oldGenericFont = font, genericFont local scale = math.Round(nut.config.get("fontScale", 1), 2) - print(ScreenScale(14) * scale, ScreenScale(14)) surface.CreateFont("nut3D2DFont", { font = font, size = 2048, @@ -428,7 +427,7 @@ function GM:ItemShowEntityMenu(entity) local options = {} local itemTable = entity:getItemTable() - if (!itemTable) then return end -- MARK: This is the where error came from. + if (not itemTable) then return end -- MARK: This is the where error came from. local function callback(index) if (IsValid(entity)) then @@ -446,10 +445,8 @@ function GM:ItemShowEntityMenu(entity) for k, v in SortedPairs(itemTable.functions) do if (k == "combine") then continue end -- yeah, noob protection - if (isfunction(v.onCanRun)) then - if (not v.onCanRun(itemTable)) then - continue - end + if (isfunction(v.onCanRun)) and (not v.onCanRun(itemTable)) then + continue end options[L(v.name or k)] = function() @@ -518,7 +515,7 @@ function GM:SetupQuickMenu(menu) RunConsoleCommand("nut_language", k) end, enabled) - if (enabled and !IsValid(current)) then + if (enabled and not IsValid(current)) then current = button end end From 65a26636ddef878dbfa24bbb8be7bce44bccbf9b Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 9 May 2021 13:20:29 +0200 Subject: [PATCH 27/50] Some code cleanup - Spaces before/after operators - Remove trailling whitespace --- gamemode/core/libs/sh_chatbox.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gamemode/core/libs/sh_chatbox.lua b/gamemode/core/libs/sh_chatbox.lua index db0b4e41..cc3aa779 100644 --- a/gamemode/core/libs/sh_chatbox.lua +++ b/gamemode/core/libs/sh_chatbox.lua @@ -9,7 +9,7 @@ end -- Returns a timestamp function nut.chat.timestamp(ooc) - return nut.config.get("chatShowTime") and (ooc and " " or "").."("..nut.date.getFormatted("%H:%M")..")"..(ooc and "" or " ") or "" + return nut.config.get("chatShowTime") and (ooc and " " or "") .. "(" .. nut.date.getFormatted("%H:%M") .. ")" .. (ooc and "" or " ") or "" end -- Registers a new chat type with the information provided. @@ -58,7 +58,7 @@ function nut.chat.register(chatType, data) end local timestamp = nut.chat.timestamp(false) - local translated = L2(chatType.."Format", name, text) + local translated = L2(chatType .. "Format", name, text) chat.AddText(timestamp, color, translated or string.format(data.format, name, text)) end @@ -97,17 +97,17 @@ function nut.chat.parse(client, message, noSend) if (type(v.prefix) == "table") then for _, prefix in ipairs(v.prefix) do -- Checking if the start of the message has the prefix. - if (message:sub(1, #prefix + (noSpaceAfter and 0 or 1)):lower() == prefix..(noSpaceAfter and "" or " "):lower()) then + if (message:sub(1, #prefix + (noSpaceAfter and 0 or 1)):lower() == prefix .. (noSpaceAfter and "" or " "):lower()) then isChosen = true - chosenPrefix = prefix..(v.noSpaceAfter and "" or " ") + chosenPrefix = prefix .. (v.noSpaceAfter and "" or " ") break end end -- Otherwise the prefix itself is checked. elseif (type(v.prefix) == "string") then - isChosen = message:sub(1, #v.prefix + (noSpaceAfter and 1 or 0)):lower() == v.prefix..(noSpaceAfter and "" or " "):lower() - chosenPrefix = v.prefix..(v.noSpaceAfter and "" or " ") + isChosen = message:sub(1, #v.prefix + (noSpaceAfter and 1 or 0)):lower() == v.prefix .. (noSpaceAfter and "" or " "):lower() + chosenPrefix = v.prefix .. (v.noSpaceAfter and "" or " ") end -- If the checks say we have the proper chat type, then the chat type is the chosen one! @@ -219,7 +219,7 @@ do -- Actions and such. nut.chat.register("it", { onChatAdd = function(speaker, text) - chat.AddText(nut.chat.timestamp(false), nut.config.get("chatColor"), "**"..text) + chat.AddText(nut.chat.timestamp(false), nut.config.get("chatColor"), "**" .. text) end, onCanHear = nut.config.get("chatRange", 280), prefix = {"/it"}, @@ -259,7 +259,7 @@ do onCanSay = function(speaker, text) if (!nut.config.get("allowGlobalOOC")) then speaker:notifyLocalized("Global OOC is disabled on this server.") - return false + return false else local delay = nut.config.get("oocDelay", 10) @@ -309,7 +309,7 @@ do icon = Material(hook.Run("GetPlayerIcon", speaker) or icon) - chat.AddText(icon, nut.chat.timestamp(true), Color(255, 50, 50), " [OOC] ", speaker, color_white, ": "..text) + chat.AddText(icon, nut.chat.timestamp(true), Color(255, 50, 50), " [OOC] ", speaker, color_white, ": " .. text) end, prefix = {"//", "/ooc"}, noSpaceAfter = true, @@ -342,7 +342,7 @@ do speaker.nutLastLOOC = CurTime() end, onChatAdd = function(speaker, text) - chat.AddText(nut.chat.timestamp(false), Color(255, 50, 50), "[LOOC] ", nut.config.get("chatColor"), speaker:Name()..": "..text) + chat.AddText(nut.chat.timestamp(false), Color(255, 50, 50), "[LOOC] ", nut.config.get("chatColor"), speaker:Name() .. ": " .. text) end, onCanHear = nut.config.get("chatRange", 280), prefix = {".//", "[[", "/looc"}, From ef02533b68048adbc611b7ebe4867b1116cb6e70 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 9 May 2021 13:53:20 +0200 Subject: [PATCH 28/50] Optimizations and code readability - Lua operators - Useless key argument in some loops - Merge double if statements --- gamemode/core/libs/sh_chatbox.lua | 76 ++++++++++++++----------------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/gamemode/core/libs/sh_chatbox.lua b/gamemode/core/libs/sh_chatbox.lua index cc3aa779..8fb55e83 100644 --- a/gamemode/core/libs/sh_chatbox.lua +++ b/gamemode/core/libs/sh_chatbox.lua @@ -3,7 +3,7 @@ nut.chat.classes = nut.char.classes or {} local DUMMY_COMMAND = {syntax = "", onRun = function() end} -if (!nut.command) then +if (not nut.command) then include("sh_command.lua") end @@ -14,7 +14,7 @@ end -- Registers a new chat type with the information provided. function nut.chat.register(chatType, data) - if (!data.onCanHear) then + if (not data.onCanHear) then -- Have a substitute if the canHear property is not found. data.onCanHear = function(speaker, listener) -- The speaker will be heard by everyone. @@ -31,9 +31,9 @@ function nut.chat.register(chatType, data) end -- Allow players to use this chat type by default. - if (!data.onCanSay) then + if (not data.onCanSay) then data.onCanSay = function(speaker, text) - if (!data.deadCanChat and !speaker:Alive()) then + if (not data.deadCanChat and not speaker:Alive()) then speaker:notifyLocalized("noPerm") return false @@ -46,12 +46,12 @@ function nut.chat.register(chatType, data) -- Chat text color. data.color = data.color or Color(242, 230, 160) - if (!data.onChatAdd) then + if (not data.onChatAdd) then data.format = data.format or "%s: \"%s\"" data.onChatAdd = function(speaker, text, anonymous) local color = data.color - local name = anonymous and L"someone" or hook.Run("GetDisplayedName", speaker, chatType) or (IsValid(speaker) and speaker:Name() or "Console") + local name = anonymous and L("someone") or hook.Run("GetDisplayedName", speaker, chatType) or (IsValid(speaker) and speaker:Name() or "Console") if (data.onGetColor) then color = data.onGetColor(speaker, text) @@ -66,7 +66,7 @@ function nut.chat.register(chatType, data) if (CLIENT and data.prefix) then if (type(data.prefix) == "table") then - for k, v in ipairs(data.prefix) do + for _, v in ipairs(data.prefix) do if (v:sub(1, 1) == "/") then nut.command.add(v:sub(2), DUMMY_COMMAND) end @@ -127,12 +127,12 @@ function nut.chat.parse(client, message, noSend) end end - if (!message:find("%S")) then + if (not message:find("%S")) then return end -- Only send if needed. - if (SERVER and !noSend) then + if (SERVER and not noSend) then -- Send the correct chat type out so other player see the message. nut.chat.send(client, chatType, hook.Run("PlayerMessageSend", client, chatType, message, anonymous) or message, anonymous) end @@ -148,10 +148,10 @@ if (SERVER) then local class = nut.chat.classes[chatType] if (class and class.onCanSay(speaker, text) ~= false) then - if (class.onCanHear and !receivers) then + if (class.onCanHear and not receivers) then receivers = {} - for k, v in ipairs(player.GetAll()) do + for _, v in ipairs(player.GetAll()) do if (v:getChar() and class.onCanHear(speaker, v) ~= false) then receivers[#receivers + 1] = v end @@ -257,30 +257,27 @@ do -- Out of character. nut.chat.register("ooc", { onCanSay = function(speaker, text) - if (!nut.config.get("allowGlobalOOC")) then - speaker:notifyLocalized("Global OOC is disabled on this server.") - return false - else - local delay = nut.config.get("oocDelay", 10) - - -- Only need to check the time if they have spoken in OOC chat before. - if (delay > 0 and speaker.nutLastOOC) then - local lastOOC = CurTime() - speaker.nutLastOOC - - -- Use this method of checking time in case the oocDelay config changes. - if (lastOOC <= delay) then - -- Admin delay bypass - if (!speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("oocDelayAdmin", false)) then + if (not nut.config.get("allowGlobalOOC")) then + speaker:notifyLocalized("Global OOC is disabled on this server.") + return false + else + local delay = nut.config.get("oocDelay", 10) + + -- Only need to check the time if they have spoken in OOC chat before. + if (delay > 0 and speaker.nutLastOOC) then + local lastOOC = CurTime() - speaker.nutLastOOC + + -- Use this method of checking time in case the oocDelay config changes (may not affect admins). + if (lastOOC <= delay and (not speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("oocDelayAdmin", false))) then speaker:notifyLocalized("oocDelay", delay - math.ceil(lastOOC)) return false end end - end - -- Save the last time they spoke in OOC. - speaker.nutLastOOC = CurTime() - end + -- Save the last time they spoke in OOC. + speaker.nutLastOOC = CurTime() + end end, onChatAdd = function(speaker, text) local icon = "icon16/user.png" @@ -322,19 +319,14 @@ do local delay = nut.config.get("loocDelay", 0) -- Only need to check the time if they have spoken in LOOC chat before. - if (speaker:IsAdmin() and nut.config.get("loocDelayAdmin", false)) then - if (delay > 0 and speaker.nutLastLOOC) then - local lastLOOC = CurTime() - speaker.nutLastLOOC - - -- Use this method of checking time in case the oocDelay config changes. - if (lastLOOC <= delay) then - -- Admin delay bypass - if (!speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("oocDelayAdmin", false)) then - speaker:notifyLocalized("oocDelay", delay - math.ceil(lastOOC)) - - return false - end - end + if (speaker:IsAdmin() and nut.config.get("loocDelayAdmin", false) and delay > 0 and speaker.nutLastLOOC) then + local lastLOOC = CurTime() - speaker.nutLastLOOC + + -- Use this method of checking time in case the oocDelay config changes (may not affect admins). + if (lastLOOC <= delay and (not speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("oocDelayAdmin", false))) then + speaker:notifyLocalized("oocDelay", delay - math.ceil(lastOOC)) + + return false end end From e8e989c542b938bb91512b2e7e62ebe59aee0720 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 9 May 2021 14:09:13 +0200 Subject: [PATCH 29/50] Fix looc admin delay Error messages and checks will now use the correct parameters. --- gamemode/core/libs/sh_chatbox.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamemode/core/libs/sh_chatbox.lua b/gamemode/core/libs/sh_chatbox.lua index 8fb55e83..537dc38d 100644 --- a/gamemode/core/libs/sh_chatbox.lua +++ b/gamemode/core/libs/sh_chatbox.lua @@ -323,8 +323,8 @@ do local lastLOOC = CurTime() - speaker.nutLastLOOC -- Use this method of checking time in case the oocDelay config changes (may not affect admins). - if (lastLOOC <= delay and (not speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("oocDelayAdmin", false))) then - speaker:notifyLocalized("oocDelay", delay - math.ceil(lastOOC)) + if (lastLOOC <= delay and (not speaker:IsAdmin() or speaker:IsAdmin() and nut.config.get("loocDelayAdmin", false))) then + speaker:notifyLocalized("loocDelay", delay - math.ceil(lastLOOC)) return false end From 6b402ea7a7c98b85475bf9f0856b881698362aca Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 9 May 2021 14:25:07 +0200 Subject: [PATCH 30/50] Add a radius property to allow a dynamic chat range As things stand, it's not possible for a range to be bound to a dynamic variable (as for example with the "chatRange" parameter which is only retrieved during registration). In order not to break compatibility with commands created on other addons/servers, I introduce a new property as a function and under the name "radius". This function will return the value of a parameter each time it's called, thus correcting this little fixed range issue. --- gamemode/core/libs/sh_chatbox.lua | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/gamemode/core/libs/sh_chatbox.lua b/gamemode/core/libs/sh_chatbox.lua index 537dc38d..9290e561 100644 --- a/gamemode/core/libs/sh_chatbox.lua +++ b/gamemode/core/libs/sh_chatbox.lua @@ -15,10 +15,21 @@ end -- Registers a new chat type with the information provided. function nut.chat.register(chatType, data) if (not data.onCanHear) then - -- Have a substitute if the canHear property is not found. - data.onCanHear = function(speaker, listener) - -- The speaker will be heard by everyone. - return true + -- Let's see first if a dynamic radius has been set. + if (isfunction(data.radius)) then + -- If this is the case, then it gives the same situation where onCanHear property is a number. + -- But instead of entering a static number, the radius function will be called each time. + -- This can be useful if you want it to be linked to a variable that can be changed. + data.onCanHear = function(speaker, listener) + -- Squared distances will always perform better than standard distances. + return (speaker:GetPos() - listener:GetPos()):LengthSqr() <= (data.radius() ^ 2) + end + else + -- Have a substitute if the canHear and radius properties are not found. + data.onCanHear = function(speaker, listener) + -- The speaker will be heard by everyone. + return true + end end elseif (isnumber(data.onCanHear)) then -- Use the value as a range and create a function to compare distances. From 2027ba4e41b52579a5305d3e4b9645f7c78964f8 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 9 May 2021 14:29:48 +0200 Subject: [PATCH 31/50] Update NutScript commands with new radius property As stated in the last commit, this will automatically adjust the range of these commands through the "chatRange" parameter. --- gamemode/core/libs/sh_chatbox.lua | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/gamemode/core/libs/sh_chatbox.lua b/gamemode/core/libs/sh_chatbox.lua index 9290e561..a8b39db5 100644 --- a/gamemode/core/libs/sh_chatbox.lua +++ b/gamemode/core/libs/sh_chatbox.lua @@ -213,14 +213,16 @@ do -- Otherwise, use the normal chat color. return nut.config.get("chatColor") end, - onCanHear = nut.config.get("chatRange", 280) + radius = function() + return nut.config.get("chatRange", 280) + end }) -- Actions and such. nut.chat.register("me", { format = "**%s %s", onGetColor = nut.chat.classes.ic.onGetColor, - onCanHear = nut.config.get("chatRange", 280), + radius = function() return nut.config.get("chatRange", 280) end, prefix = {"/me", "/action"}, font = "nutChatFontItalics", filter = "actions", @@ -232,7 +234,9 @@ do onChatAdd = function(speaker, text) chat.AddText(nut.chat.timestamp(false), nut.config.get("chatColor"), "**" .. text) end, - onCanHear = nut.config.get("chatRange", 280), + radius = function() + return nut.config.get("chatRange", 280) + end, prefix = {"/it"}, font = "nutChatFontItalics", filter = "actions", @@ -248,7 +252,9 @@ do -- Make the whisper chat slightly darker than IC chat. return Color(color.r - 35, color.g - 35, color.b - 35) end, - onCanHear = nut.config.get("chatRange", 280) * 0.25, + radius = function() + return nut.config.get("chatRange", 280) * 0.25 + end, prefix = {"/w", "/whisper"} }) @@ -261,7 +267,9 @@ do -- Make the yell chat slightly brighter than IC chat. return Color(color.r + 35, color.g + 35, color.b + 35) end, - onCanHear = nut.config.get("chatRange", 280) * 2, + radius = function() + return nut.config.get("chatRange", 280) * 2 + end, prefix = {"/y", "/yell"} }) @@ -347,7 +355,9 @@ do onChatAdd = function(speaker, text) chat.AddText(nut.chat.timestamp(false), Color(255, 50, 50), "[LOOC] ", nut.config.get("chatColor"), speaker:Name() .. ": " .. text) end, - onCanHear = nut.config.get("chatRange", 280), + radius = function() + return nut.config.get("chatRange", 280) + end, prefix = {".//", "[[", "/looc"}, noSpaceAfter = true, filter = "ooc" @@ -359,7 +369,7 @@ do color = Color(155, 111, 176), filter = "actions", font = "nutChatFontItalics", - onCanHear = nut.config.get("chatRange", 280), + radius = function() return nut.config.get("chatRange", 280) end, deadCanChat = true }) end) @@ -378,7 +388,6 @@ nut.chat.register("event", { onCanSay = function(speaker, text) return speaker:IsAdmin() end, - onCanHear = 1000000, onChatAdd = function(speaker, text) chat.AddText(nut.chat.timestamp(false), Color(255, 150, 0), text) end, From 28ee44ef5e8e65a8dfa7cd59238df7dbbb9532fe Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 9 May 2021 17:36:57 +0200 Subject: [PATCH 32/50] Fix the display of the typing indicator for players in vehicles This change will allow the display of the indicator when players are in a vehicle. --- plugins/typing.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/typing.lua b/plugins/typing.lua index ba76a9e8..4bc845ff 100644 --- a/plugins/typing.lua +++ b/plugins/typing.lua @@ -30,16 +30,16 @@ if (CLIENT) then data.start = localPlayer:EyePos() data.filter = localPlayer - for k, v in ipairs(player.GetAll()) do - local isActing = v:getNetVar("actAng") + for _, v in ipairs(player.GetAll()) do + local specialState = v:InVehicle() or v:getNetVar("actAng") if ( v ~= localPlayer and v:getNetVar("typing") and - (v:GetMoveType() == MOVETYPE_WALK or isActing) + (v:GetMoveType() == MOVETYPE_WALK or specialState) ) then data.endpos = v:EyePos() - if (util.TraceLine(data).Entity ~= v and not isActing) then continue end + if (util.TraceLine(data).Entity ~= v and not specialState) then continue end local position = v:GetPos() alpha = (1 - (ourPos:DistToSqr(position) / 65536)) * 255 if (alpha <= 0) then continue end From 48aa83a309a590134dec3ee34bda12e9b04380c6 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 9 May 2021 18:55:53 +0200 Subject: [PATCH 33/50] Some cleanup and code improvements - Spaces before/after operators - Remove useless argument in "cfgSet" notification - Reduction of pyramid scopes - Replace C operators to Lua ones (My linter is still not happy, but the number of issues has already been reduced a lot compared to the original copy. The code should probably be redesigned in the future) --- gamemode/core/sh_config.lua | 166 ++++++++++++++++++------------------ 1 file changed, 85 insertions(+), 81 deletions(-) diff --git a/gamemode/core/sh_config.lua b/gamemode/core/sh_config.lua index 6d725bd2..1f9592ee 100644 --- a/gamemode/core/sh_config.lua +++ b/gamemode/core/sh_config.lua @@ -2,10 +2,10 @@ nut.config = nut.config or {} nut.config.stored = nut.config.stored or {} function nut.config.add(key, value, desc, callback, data, noNetworking, schemaOnly) - assert(isstring(key), "expected config key to be string, got "..type(key)) + assert(isstring(key), "expected config key to be string, got " .. type(key)) local oldConfig = nut.config.stored[key] - nut.config.stored[key] = {data = data, value = oldConfig and oldConfig.value or value, default = value, desc = desc, noNetworking = noNetworking, global = !schemaOnly, callback = callback} + nut.config.stored[key] = {data = data, value = oldConfig and oldConfig.value or value, default = value, desc = desc, noNetworking = noNetworking, global = not schemaOnly, callback = callback} end function nut.config.setDefault(key, value) @@ -36,7 +36,7 @@ function nut.config.set(key, value) config.value = value if (SERVER) then - if (!config.noNetworking) then + if (not config.noNetworking) then netstream.Start(nil, "cfgSet", key, value) end @@ -132,14 +132,14 @@ if (SERVER) then local count = table.Count(value) local i = 1 - for k, v in SortedPairs(value) do - value2 = value2..v..(i == count and "]" or ", ") + for _, v in SortedPairs(value) do + value2 = value2 .. v .. (i == count and "]" or ", ") i = i + 1 end value = value2 end - nut.util.notifyLocalized("cfgSet", nil, client:Name(), key, tostring(value), v) + nut.util.notifyLocalized("cfgSet", nil, client:Name(), key, tostring(value)) end end) else @@ -182,94 +182,98 @@ end if (CLIENT) then hook.Add("CreateMenuButtons", "nutConfig", function(tabs) - if (LocalPlayer():IsSuperAdmin() and hook.Run("CanPlayerUseConfig", LocalPlayer()) ~= false) then - tabs["config"] = function(panel) - local scroll = panel:Add("DScrollPanel") - scroll:Dock(FILL) + if (not LocalPlayer():IsSuperAdmin() or hook.Run("CanPlayerUseConfig", LocalPlayer()) == false) then + return + end - hook.Run("CreateConfigPanel", panel) + tabs["config"] = function(panel) + local scroll = panel:Add("DScrollPanel") + scroll:Dock(FILL) - local properties = scroll:Add("DProperties") - properties:SetSize(panel:GetSize()) + hook.Run("CreateConfigPanel", panel) - nut.gui.properties = properties + local properties = scroll:Add("DProperties") + properties:SetSize(panel:GetSize()) - -- We're about to store the categories in this buffer. - local buffer = {} + nut.gui.properties = properties - for k, v in pairs(nut.config.stored) do - -- Get the category name. - local index = v.data and v.data.category or "misc" + -- We're about to store the categories in this buffer. + local buffer = {} - -- Insert the config into the category list. - buffer[index] = buffer[index] or {} - buffer[index][k] = v - end + for k, v in pairs(nut.config.stored) do + -- Get the category name. + local index = v.data and v.data.category or "misc" - -- Loop through the categories in alphabetical order. - for category, configs in SortedPairs(buffer) do - category = L(category) - - -- Ditto, except we're looping through configs. - for k, v in SortedPairs(configs) do - -- Determine which type of panel to create. - local form = v.data and v.data.form - local value = nut.config.stored[k].default - - if (!form) then - local formType = type(value) - - if (formType == "number") then - form = "Int" - value = tonumber(nut.config.get(k)) or value - elseif (formType == "boolean") then - form = "Boolean" - value = tobool(nut.config.get(k)) - else - form = "Generic" - value = nut.config.get(k) or value - end - end + -- Insert the config into the category list. + buffer[index] = buffer[index] or {} + buffer[index][k] = v + end - -- VectorColor currently only exists for DProperties. - if (form == "Generic" and type(value) == "table" and value.r and value.g and value.b) then - -- Convert the color to a vector. - value = Vector(value.r / 255, value.g / 255, value.b / 255) - form = "VectorColor" + -- Loop through the categories in alphabetical order. + for category, configs in SortedPairs(buffer) do + category = L(category) + + -- Ditto, except we're looping through configs. + for k, v in SortedPairs(configs) do + -- Determine which type of panel to create. + local form = v.data and v.data.form + local value = nut.config.stored[k].default + + if (not form) then + local formType = type(value) + + if (formType == "number") then + form = "Int" + value = tonumber(nut.config.get(k)) or value + elseif (formType == "boolean") then + form = "Boolean" + value = tobool(nut.config.get(k)) + else + form = "Generic" + value = nut.config.get(k) or value end + end - local delay = 1 + -- VectorColor currently only exists for DProperties. + if (form == "Generic" and type(value) == "table" and value.r and value.g and value.b) then + -- Convert the color to a vector. + value = Vector(value.r / 255, value.g / 255, value.b / 255) + form = "VectorColor" + end - if (form == "Boolean") then - delay = 0 - end + local delay = 1 - -- Add a new row for the config to the properties. - local row = properties:CreateRow(category, tostring(k)) - row:Setup(form, v.data and v.data.data or {}) - row:SetValue(value) - row:SetTooltip(v.desc) - row.DataChanged = function(this, value) - timer.Create("nutCfgSend"..k, delay, 1, function() - if (IsValid(row)) then - if (form == "VectorColor") then - local vector = Vector(value) - - value = Color(math.floor(vector.x * 255), math.floor(vector.y * 255), math.floor(vector.z * 255)) - elseif (form == "Int" or form == "Float") then - value = tonumber(value) - - if (form == "Int") then - value = math.Round(value) - end - elseif (form == "Boolean") then - value = tobool(value) - end - - netstream.Start("cfgSet", k, value) + if (form == "Boolean") then + delay = 0 + end + + -- Add a new row for the config to the properties. + local row = properties:CreateRow(category, tostring(k)) + row:Setup(form, v.data and v.data.data or {}) + row:SetValue(value) + row:SetTooltip(v.desc) + row.DataChanged = function(this, newValue) + timer.Create("nutCfgSend" .. k, delay, 1, function() + if (not IsValid(row)) then + return + end + + if (form == "VectorColor") then + local vector = Vector(newValue) + + newValue = Color(math.floor(vector.x * 255), math.floor(vector.y * 255), math.floor(vector.z * 255)) + elseif (form == "Int" or form == "Float") then + newValue = tonumber(newValue) + + if (form == "Int") then + newValue = math.Round(newValue) end - end) - end + elseif (form == "Boolean") then + newValue = tobool(newValue) + end + + netstream.Start("cfgSet", k, newValue) + end) end end end From 9c4b808fa2cd4779abddb9c50affadd4d19ad116 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 9 May 2021 19:01:40 +0200 Subject: [PATCH 34/50] Fixed the display of some parameter values Before this change, only the parameters without an explicit form had their current value and not the one defined by default. Now this annoying problem is fixed. --- gamemode/core/sh_config.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gamemode/core/sh_config.lua b/gamemode/core/sh_config.lua index 1f9592ee..d0407163 100644 --- a/gamemode/core/sh_config.lua +++ b/gamemode/core/sh_config.lua @@ -219,7 +219,20 @@ if (CLIENT) then local form = v.data and v.data.form local value = nut.config.stored[k].default - if (not form) then + -- Let's see if the parameter has a form to perform some additional operations. + if (form) then + if (form == "Int") then + -- math.Round can create an error without failing silently as expected if the parameter is invalid. + -- So an alternate value is entered directly into the function and not outside of it. + value = math.Round(nut.config.get(k) or value) + elseif (form == "Float") then + value = tonumber(nut.config.get(k)) or value + elseif (form == "Boolean") then + value = tobool(nut.config.get(k)) or value + else + value = nut.config.get(k) or value + end + else local formType = type(value) if (formType == "number") then From d6501f9bbdf5554397b0824c5d0c2a1924b3719d Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Mon, 10 May 2021 12:02:25 +0300 Subject: [PATCH 35/50] Add paylimit Add a paylimit, meaning that the char will not get an autopay when the char's money has reached this limit --- gamemode/core/hooks/sv_hooks.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gamemode/core/hooks/sv_hooks.lua b/gamemode/core/hooks/sv_hooks.lua index 9609dd18..a1911aa7 100644 --- a/gamemode/core/hooks/sv_hooks.lua +++ b/gamemode/core/hooks/sv_hooks.lua @@ -728,7 +728,7 @@ function GM:CreateSalaryTimer(client) 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 - + local limit = hook.Run("GetSalaryLimit", client, faction, class) or (class and class.payLimit) or (faction and faction.playLimit) or nil if (not pay) then return end local timerID = "nutSalary"..client:SteamID() @@ -740,7 +740,9 @@ function GM:CreateSalaryTimer(client) timer.Remove(timerID) return end - + if limit and character:getMoney() >= limit then + return + end character:giveMoney(pay) client:notifyLocalized("salary", nut.currency.get(pay)) end) From e134bc01d2f3af6a2dd03f0e779bb8f2bfead32c Mon Sep 17 00:00:00 2001 From: Xem0n Date: Mon, 10 May 2021 20:48:09 +0200 Subject: [PATCH 36/50] Added hook to allow custom checks on commands Thanks to it plugins' authors would be able to provide custom checks on commands for players that normally wouldn't be able to run them. For example, a flag that gives access to charsetmodel or plytransfer for faction leaders. --- gamemode/core/libs/sh_command.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gamemode/core/libs/sh_command.lua b/gamemode/core/libs/sh_command.lua index 4e0126d0..54a5f802 100644 --- a/gamemode/core/libs/sh_command.lua +++ b/gamemode/core/libs/sh_command.lua @@ -56,10 +56,10 @@ function nut.command.add(command, data) data._onRun = data.onRun -- for refactoring purpose. data.onRun = function(client, arguments) - if (!onCheckAccess(client)) then - return "@noPerm" - else + if (hook.Run("CanPlayerUseCommand", client, command) or onCheckAccess(client)) then return onRun(client, arguments) + else + return "@noPerm" end end end From 28fb25364c76d86713df5c65093eef72f486d02c Mon Sep 17 00:00:00 2001 From: VindoesCompooter <100soundsystem32@gmail.com> Date: Mon, 10 May 2021 22:30:04 +0100 Subject: [PATCH 37/50] Re-add transfer function Since we don't have a dedicated transfer function, I thought I'd just add one for ease of use. --- gamemode/core/meta/item/sv_item.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gamemode/core/meta/item/sv_item.lua b/gamemode/core/meta/item/sv_item.lua index 5f49778f..950c1074 100644 --- a/gamemode/core/meta/item/sv_item.lua +++ b/gamemode/core/meta/item/sv_item.lua @@ -101,6 +101,21 @@ function ITEM:spawn(position, angles) end end +function ITEM:transfer(newInventory,bBypass) + if (!bBypass and !newInventory:canAccess("transfer")) then + return false + end + + local inventory = nut.inventory.instances[self.invID] + + inventory:removeItem(self.id, true) + :next(function() + newInventory:add(self) + end) + + return true +end + -- Called when an instance of this item has been created. function ITEM:onInstanced(id) end From 10f69d32ab69b6ff214a76cf78ebe217387f63b2 Mon Sep 17 00:00:00 2001 From: baratoxis <33399712+baratoxis@users.noreply.github.com> Date: Sat, 15 May 2021 16:28:40 +0100 Subject: [PATCH 38/50] Discord Info Change --- gamemode/languages/sh_spanish.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemode/languages/sh_spanish.lua b/gamemode/languages/sh_spanish.lua index 3b5c7be6..dec2466e 100644 --- a/gamemode/languages/sh_spanish.lua +++ b/gamemode/languages/sh_spanish.lua @@ -1,4 +1,4 @@ ----//Translation made by DasBarata#2411 & CVAROG#7222\\---- +---//Translation made by Barata#2411 & CVAROG#7222\\---- ---//Contact DasBarata#2411 if you have any translation change suggestion\\---- NAME = "Español" LANGUAGE = { From e7f51980b3bef8f1e2daaf189d842eba7aefd5a5 Mon Sep 17 00:00:00 2001 From: baratoxis <33399712+baratoxis@users.noreply.github.com> Date: Mon, 17 May 2021 10:59:24 +0100 Subject: [PATCH 39/50] Simple Discord Change (#73) --- gamemode/languages/sh_portuguese.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemode/languages/sh_portuguese.lua b/gamemode/languages/sh_portuguese.lua index 2cecab70..25c570c5 100644 --- a/gamemode/languages/sh_portuguese.lua +++ b/gamemode/languages/sh_portuguese.lua @@ -1,4 +1,4 @@ -NAME = "Portuguese" ---//Contact DasBarata#2411 if you have any translation change suggestion\\---- +NAME = "Portuguese" ---//Contact Barata#2411 if you have any translation change suggestion\\---- LANGUAGE = { From 813a08a63533519ca8c6b290e0ad7e39c9f6b026 Mon Sep 17 00:00:00 2001 From: Florian Dubois Date: Sun, 23 May 2021 11:13:23 +0200 Subject: [PATCH 40/50] Allow static numbers in the radius property As requested by Tovarisch and for consistency with the rest of the code. --- gamemode/core/libs/sh_chatbox.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gamemode/core/libs/sh_chatbox.lua b/gamemode/core/libs/sh_chatbox.lua index a8b39db5..8efd7614 100644 --- a/gamemode/core/libs/sh_chatbox.lua +++ b/gamemode/core/libs/sh_chatbox.lua @@ -24,6 +24,14 @@ function nut.chat.register(chatType, data) -- Squared distances will always perform better than standard distances. return (speaker:GetPos() - listener:GetPos()):LengthSqr() <= (data.radius() ^ 2) end + elseif (isnumber(data.radius)) then + -- To avoid confusion, the radius can be a static number. + -- In this case, we use the same method as the one used for the "onCanHear" property. + local range = data.radius ^ 2 + + data.onCanHear = function(speaker, listener) + return (speaker:GetPos() - listener:GetPos()):LengthSqr() <= range + end else -- Have a substitute if the canHear and radius properties are not found. data.onCanHear = function(speaker, listener) From 711a6e1df2b48b15e375b0cc8d2b0aeffe1c3961 Mon Sep 17 00:00:00 2001 From: VindoesCompooter <100soundsystem32@gmail.com> Date: Mon, 24 May 2021 23:45:19 +0100 Subject: [PATCH 41/50] Add getmodel hook Useful for overriding --- gamemode/core/meta/sh_item.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gamemode/core/meta/sh_item.lua b/gamemode/core/meta/sh_item.lua index ffe77d51..ea89167f 100644 --- a/gamemode/core/meta/sh_item.lua +++ b/gamemode/core/meta/sh_item.lua @@ -50,6 +50,10 @@ else end end +function ITEM:getModel() + return self.model +end + function ITEM:getPrice() local price = self.price From 1e9dfd271a23c3652f76c348281517069fe54754 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Fri, 28 May 2021 11:17:24 +0300 Subject: [PATCH 42/50] allow tables for faction bodygroups either the classic "012121" or {[1] = 2, [2] = 4, [3] =1 } for more control over available bodygroups --- gamemode/core/libs/sh_character.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gamemode/core/libs/sh_character.lua b/gamemode/core/libs/sh_character.lua index 8338bd0d..29dcaec4 100644 --- a/gamemode/core/libs/sh_character.lua +++ b/gamemode/core/libs/sh_character.lua @@ -265,10 +265,16 @@ do newData.data.skin = model[2] or 0 local groups = {} - local i = 0 - for value in model[3]:gmatch("%d") do - groups[i] = tonumber(value) - i = i + 1 + if isstring(model[3]) then + local i = 0 + for value in model[3]:gmatch("%d") do + groups[i] = tonumber(value) + i = i + 1 + end + elseif istable(model[3]) then + for k, v in pairs(model[3]) do + groups[tonumber(k)] = tonumber(v) + end end newData.data.groups = groups end @@ -422,7 +428,7 @@ do function playerMeta:Name() local character = self.getChar(self) - + return character and character.getName(character) or self.steamName(self) From 55367992330617dc7dcb6c1fac61f9fd7f5b7779 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Fri, 28 May 2021 11:36:21 +0300 Subject: [PATCH 43/50] make inv icons use overridable stuff + add getSkin for items --- gamemode/core/derma/cl_inventory.lua | 4 ++-- gamemode/core/meta/sh_item.lua | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gamemode/core/derma/cl_inventory.lua b/gamemode/core/derma/cl_inventory.lua index b37097f0..bc3d8abd 100644 --- a/gamemode/core/derma/cl_inventory.lua +++ b/gamemode/core/derma/cl_inventory.lua @@ -41,7 +41,7 @@ function PANEL:setItemType(itemTypeOrID) self.nutToolTip = true self.itemTable = item - self:SetModel(item.model, item.skin) + self:SetModel(item:getModel(), item:getSkin()) self:updateTooltip() if (item.exRender) then @@ -111,7 +111,7 @@ function PANEL:PaintOver(w, h) itemTable.paintOver(self, itemTable, w, h) end - + hook.Run("ItemPaintOver", self, itemTable, w, h) end diff --git a/gamemode/core/meta/sh_item.lua b/gamemode/core/meta/sh_item.lua index ea89167f..ceadc567 100644 --- a/gamemode/core/meta/sh_item.lua +++ b/gamemode/core/meta/sh_item.lua @@ -54,6 +54,10 @@ function ITEM:getModel() return self.model end +function ITEM:getSkin() + return self.skin +end + function ITEM:getPrice() local price = self.price From 908de590c3567f4df4a8a63d0138a937abbff98c Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Mon, 14 Jun 2021 15:02:13 +0300 Subject: [PATCH 44/50] Update sh_util.lua --- gamemode/core/sh_util.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamemode/core/sh_util.lua b/gamemode/core/sh_util.lua index b0f94112..61201589 100644 --- a/gamemode/core/sh_util.lua +++ b/gamemode/core/sh_util.lua @@ -37,8 +37,8 @@ function nut.util.includeDir(directory, fromLua, recursive) baseDir = SCHEMA.folder.."/schema/" else baseDir = baseDir.."/gamemode/" - end - + end + if recursive then local function AddRecursive(folder) local files, folders = file.Find(folder.."/*", "LUA") From ecb3418ac1d93f294014eed9da7a125baed8e738 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Tue, 29 Jun 2021 12:00:32 +0300 Subject: [PATCH 45/50] Set max starting points for attribs --- gamemode/core/sh_commands.lua | 57 ++++++++++--------- plugins/attributes/derma/cl_attribute.lua | 12 ++-- .../attributes/derma/cl_attributes_step.lua | 9 ++- plugins/attributes/libs/sh_attribs.lua | 8 +-- .../plugins/strength/attributes/sh_str.lua | 4 +- plugins/attributes/sh_plugin.lua | 3 +- 6 files changed, 49 insertions(+), 44 deletions(-) diff --git a/gamemode/core/sh_commands.lua b/gamemode/core/sh_commands.lua index 43d722b2..b7528379 100644 --- a/gamemode/core/sh_commands.lua +++ b/gamemode/core/sh_commands.lua @@ -66,12 +66,12 @@ nut.command.add("flaggive", { if (IsValid(target) and target:getChar()) then local flags = arguments[2] - if (!flags) then + if (not flags) then local available = "" -- Aesthetics~~ for k in SortedPairs(nut.flag.list) do - if (!target:getChar():hasFlags(k)) then + if (not target:getChar():hasFlags(k)) then available = available..k end end @@ -97,7 +97,7 @@ nut.command.add("flagtake", { if (IsValid(target) and target:getChar()) then local flags = arguments[2] - if (!flags) then + if (not flags) then return client:requestString("@flagTakeTitle", "@flagTakeDesc", function(text) nut.command.run(client, "flagtake", {target:Name(), text}) end, target:getChar():getFlags()) @@ -114,7 +114,7 @@ nut.command.add("charsetmodel", { adminOnly = true, syntax = " ", onRun = function(client, arguments) - if (!arguments[2]) then + if (not arguments[2]) then return L("invalidArg", client, 2) end @@ -179,7 +179,7 @@ nut.command.add("charsetname", { onRun = function(client, arguments) local target = nut.command.findPlayer(client, arguments[1]) - if (IsValid(target) and !arguments[2]) then + if (IsValid(target) and not arguments[2]) then return client:requestString("@chgName", "@chgNameDesc", function(text) nut.command.run(client, "charsetname", {target:Name(), text}) end, target:Name()) @@ -201,7 +201,7 @@ nut.command.add("chargiveitem", { adminOnly = true, syntax = " ", onRun = function(client, arguments) - if (!arguments[2]) then + if (not arguments[2]) then return L("invalidArg", client, 2) end @@ -211,7 +211,7 @@ nut.command.add("chargiveitem", { local uniqueID = arguments[2]:lower() local amount = tonumber(arguments[3]) - if (!nut.item.list[uniqueID]) then + if (not nut.item.list[uniqueID]) then for k, v in SortedPairs(nut.item.list) do if (nut.util.stringMatches(v.name, uniqueID)) then uniqueID = k @@ -221,7 +221,7 @@ nut.command.add("chargiveitem", { end end - if (arguments[3] and arguments[3] ~= "") and (!amount) then + if (arguments[3] and arguments[3] ~= "") and (not amount) then return L("invalidArg", client, 3) end @@ -312,14 +312,14 @@ nut.command.add("charunban", { client.nutNextSearch = 0 - if (!data.banned) then + if (not data.banned) then return client:notifyLocalized("charNotBanned") end data.banned = nil nut.db.updateTable({_data = data}, nil, nil, "_id = "..charID) - nut.util.notifyLocalized("charUnBan", nil, client:Name(), v:getName()) + nut.util.notifyLocalized("charUnBan", nil, client:Name(), nut.char.loaded[charID]:getName()) end end) end @@ -332,7 +332,7 @@ nut.command.add("givemoney", { number = number or 0 local amount = math.floor(number) - if (!amount or !isnumber(amount) or amount <= 0) then + if (not amount or not isnumber(amount) or amount <= 0) then return L("invalidArg", client, 1) end @@ -345,7 +345,7 @@ nut.command.add("givemoney", { if (IsValid(target) and target:IsPlayer() and target:getChar()) then amount = math.Round(amount) - if (!client:getChar():hasMoney(amount)) then + if (not client:getChar():hasMoney(amount)) then return end @@ -366,7 +366,7 @@ nut.command.add("charsetmoney", { onRun = function(client, arguments) local amount = tonumber(arguments[2]) - if (!amount or !isnumber(amount) or amount < 0) then + if (not amount or not isnumber(amount) or amount < 0) then return "@invalidArg", 2 end @@ -374,7 +374,7 @@ nut.command.add("charsetmoney", { if (IsValid(target)) then local char = target:getChar() - + if (char and amount) then amount = math.Round(amount) char:setMoney(amount) @@ -389,13 +389,13 @@ nut.command.add("dropmoney", { onRun = function(client, arguments) local amount = tonumber(arguments[1]) - if (!amount or !isnumber(amount) or amount < 1) then + if (not amount or not isnumber(amount) or amount < 1) then return "@invalidArg", 1 end amount = math.Round(amount) - - if (!client:getChar():hasMoney(amount)) then + + if (not client:getChar():hasMoney(amount)) then return end @@ -403,7 +403,7 @@ nut.command.add("dropmoney", { local money = nut.currency.spawn(client:getItemDropPos(), amount) money.client = client money.charID = client:getChar():getID() - + client:doGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_ITEM_PLACE, true) end }) @@ -432,11 +432,11 @@ nut.command.add("chargetup", { onRun = function(client, arguments) local entity = client.nutRagdoll - if (IsValid(entity) and entity.nutGrace and entity.nutGrace < CurTime() and entity:GetVelocity():Length2D() < 8 and !entity.nutWakingUp) then + if (IsValid(entity) and entity.nutGrace and entity.nutGrace < CurTime() and entity:GetVelocity():Length2D() < 8 and not entity.nutWakingUp) then entity.nutWakingUp = true client:setAction("@gettingUp", 5, function() - if (!IsValid(entity)) then + if (not IsValid(entity)) then return end @@ -451,7 +451,7 @@ nut.command.add("plyunwhitelist", { syntax = " ", onRun = function(client, arguments) local target = nut.command.findPlayer(client, arguments[1]) - + if (IsValid(target)) then local faction = nut.command.findFaction(client,table.concat(arguments, " ", 2)) @@ -471,7 +471,7 @@ nut.command.add("fallover", { onRun = function(client, arguments) local time = tonumber(arguments[1]) - if (!isnumber(time)) then + if (not isnumber(time)) then time = 5 end @@ -481,7 +481,7 @@ nut.command.add("fallover", { time = nil end - if (!IsValid(client.nutRagdoll)) then + if (not IsValid(client.nutRagdoll)) then client:setRagdolled(true, time) end end @@ -495,7 +495,7 @@ nut.command.add("beclass", { if (IsValid(client) and char) then local num = isnumber(tonumber(class)) and tonumber(class) or -1 - + if (nut.class.list[num]) then local v = nut.class.list[num] @@ -523,7 +523,7 @@ nut.command.add("beclass", { end end end - + client:notifyLocalized("invalid", L("class", client)) else client:notifyLocalized("illegalAccess") @@ -536,7 +536,7 @@ nut.command.add("chardesc", { onRun = function(client, arguments) arguments = table.concat(arguments, " ") - if (!arguments:find("%S")) then + if (not arguments:find("%S")) then return client:requestString("@chgDesc", "@chgDescDesc", function(text) nut.command.run(client, "chardesc", {text}) end, client:getChar():getDesc()) @@ -584,7 +584,8 @@ nut.command.add("plytransfer", { v, client:Name(), target:Name(), L(faction.name, v) ) end - end + end, + alias = "charsetfaction" }) -- Credit goes to SmithyStanley @@ -593,7 +594,7 @@ nut.command.add("clearinv", { syntax = "", onRun = function (client, arguments) local target = nut.command.findPlayer(client, arguments[1]) - + if (IsValid(target) and target:getChar()) then for k, v in pairs(target:getChar():getInv():getItems()) do v:remove() diff --git a/plugins/attributes/derma/cl_attribute.lua b/plugins/attributes/derma/cl_attribute.lua index 4bcf1fc8..26c338d2 100644 --- a/plugins/attributes/derma/cl_attribute.lua +++ b/plugins/attributes/derma/cl_attribute.lua @@ -88,10 +88,8 @@ local PANEL = {} end function PANEL:Think() - if (self.pressing) then - if ((self.nextPress or 0) < CurTime()) then - self:doChange() - end + if self.pressing and ((self.nextPress or 0) < CurTime()) then + self:doChange() end self.deltaValue = math.Approach(self.deltaValue, self.value, FrameTime() * 15) @@ -101,9 +99,9 @@ local PANEL = {} if ((self.value == 0 and self.pressing == -1) or (self.value == self.max and self.pressing == 1)) then return end - + self.nextPress = CurTime() + 0.2 - + if (self:onChanged(self.pressing) ~= false) then self.value = math.Clamp(self.value + self.pressing, 0, self.max) end @@ -136,7 +134,7 @@ local PANEL = {} self.sub:Remove() self.add:Remove() end - + function PANEL:Paint(w, h) surface.SetDrawColor(0, 0, 0, 200) surface.DrawRect(0, 0, w, h) diff --git a/plugins/attributes/derma/cl_attributes_step.lua b/plugins/attributes/derma/cl_attributes_step.lua index e89a3f00..74a9938b 100644 --- a/plugins/attributes/derma/cl_attributes_step.lua +++ b/plugins/attributes/derma/cl_attributes_step.lua @@ -54,12 +54,14 @@ end function PANEL:onPointChange(key, delta) if (not key) then return 0 end local attribs = self:getContext("attribs", {}) + local startingMax = nut.attribs.list[key].startingMax or nil local quantity = attribs[key] or 0 local newQuantity = quantity + delta local newPointsLeft = self.left - delta if ( newPointsLeft < 0 or newPointsLeft > self.total or - newQuantity < 0 or newQuantity > self.total + newQuantity < 0 or newQuantity > self.total or + (startingMax and startingMax < newQuantity) ) then return quantity end @@ -100,7 +102,7 @@ function PANEL:Init() self.quantity:Dock(FILL) self.quantity:SetText("0") self.quantity:SetContentAlignment(5) - + self.name = self:Add("DLabel") self.name:SetFont("nutCharSubTitleFont") self.name:SetContentAlignment(4) @@ -111,8 +113,9 @@ end function PANEL:setAttribute(key, attribute) self.key = key + local startingMax = nut.attribs.list[key].startingMax or nil self.name:SetText(L(attribute.name)) - self:SetToolTip(L(attribute.desc or "noDesc")) + self:SetTooltip(L(attribute.desc or "noDesc").. (startingMax and " Max: "..startingMax or "")) end function PANEL:delta(delta) diff --git a/plugins/attributes/libs/sh_attribs.lua b/plugins/attributes/libs/sh_attribs.lua index 715664da..c4bfbe80 100644 --- a/plugins/attributes/libs/sh_attribs.lua +++ b/plugins/attributes/libs/sh_attribs.lua @@ -2,7 +2,7 @@ nut.attribs = nut.attribs or {} nut.attribs.list = nut.attribs.list or {} function nut.attribs.loadFromDir(directory) - for k, v in ipairs(file.Find(directory.."/*.lua", "LUA")) do + for _, v in ipairs(file.Find(directory.."/*.lua", "LUA")) do local niceName = v:sub(4, -5) ATTRIBUTE = nut.attribs.list[niceName] or {} @@ -39,10 +39,10 @@ do if (SERVER) then function charMeta:updateAttrib(key, value) local attribute = nut.attribs.list[key] + local client = self:getPlayer() if (attribute) then local attrib = self:getAttribs() - local client = self:getPlayer() attrib[key] = math.min((attrib[key] or 0) + value, attribute.maxValue or nut.config.get("maxAttribs", 30)) @@ -125,10 +125,10 @@ do local boosts = self:getBoosts()[key] if (boosts) then - for k, v in pairs(boosts) do + for _, v in pairs(boosts) do att = att + v end - end + end return att end diff --git a/plugins/attributes/plugins/strength/attributes/sh_str.lua b/plugins/attributes/plugins/strength/attributes/sh_str.lua index e04c2015..56ed8610 100644 --- a/plugins/attributes/plugins/strength/attributes/sh_str.lua +++ b/plugins/attributes/plugins/strength/attributes/sh_str.lua @@ -1,2 +1,4 @@ ATTRIBUTE.name = "Strength" -ATTRIBUTE.desc = "A measure of how strong you are." \ No newline at end of file +ATTRIBUTE.desc = "A measure of how strong you are." +--ATTRIBUTE.startingMax = 10 +--ATTRIBUTE.noStartBonus = false \ No newline at end of file diff --git a/plugins/attributes/sh_plugin.lua b/plugins/attributes/sh_plugin.lua index 8d4781e1..bc47c684 100644 --- a/plugins/attributes/sh_plugin.lua +++ b/plugins/attributes/sh_plugin.lua @@ -26,9 +26,10 @@ nut.char.registerVar("attribs", { local count = 0 for k, v in pairs(value) do + local max = nut.attribs.list[k] and nut.attribs.list[k].startingMax or nil + if max and max < v then return false, nut.attribs.list[k].name .. " too high" end count = count + v end - local points = hook.Run("GetStartAttribPoints", client, count) or nut.config.get("maxAttribs", 30) if (count > points) then From b1855f78330d327363f4a5d86b0ef981aaac6b64 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:53:46 +0300 Subject: [PATCH 46/50] Fixed a bug where door info won't draw when it should --- plugins/doors/cl_plugin.lua | 2 +- plugins/doors/sh_commands.lua | 8 ++++---- plugins/gridinv/sv_transfer.lua | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/doors/cl_plugin.lua b/plugins/doors/cl_plugin.lua index 0476e846..36dc09f4 100644 --- a/plugins/doors/cl_plugin.lua +++ b/plugins/doors/cl_plugin.lua @@ -17,7 +17,7 @@ local configGet = nut.config.get local teamGetColor = team.GetColor function PLUGIN:DrawEntityInfo(entity, alpha) - if (entity.isDoor(entity) and !entity:getNetVar("hidden") and hook.Run("CanDrawDoorInfo", entity)) then + if (entity.isDoor(entity) and !entity:getNetVar("hidden") and hook.Run("CanDrawDoorInfo", entity)) ~= false then local position = toScreen(entity.LocalToWorld(entity, entity.OBBCenter(entity))) local x, y = position.x, position.y local owner = entity.GetDTEntity(entity, 0) diff --git a/plugins/doors/sh_commands.lua b/plugins/doors/sh_commands.lua index c08ad6a2..565e9a77 100644 --- a/plugins/doors/sh_commands.lua +++ b/plugins/doors/sh_commands.lua @@ -36,7 +36,7 @@ nut.command.add("doorsell", { else -- Tell the player the door isn't valid. client:notifyLocalized("dNotValid") - end + end end }) @@ -70,7 +70,7 @@ nut.command.add("doorbuy", { entity.nutAccess = { [client] = DOOR_OWNER } - + PLUGIN:callOnDoorChildren(entity, function(child) child:SetDTEntity(0, client) end) @@ -356,7 +356,7 @@ nut.command.add("doorsetchild", { else -- Tell the player the door isn't valid. client:notifyLocalized("dNotValid") - end + end end }) @@ -393,7 +393,7 @@ nut.command.add("doorremovechild", { else -- Tell the player the door isn't valid. client:notifyLocalized("dNotValid") - end + end end }) diff --git a/plugins/gridinv/sv_transfer.lua b/plugins/gridinv/sv_transfer.lua index 5b90a07d..b4ee727f 100644 --- a/plugins/gridinv/sv_transfer.lua +++ b/plugins/gridinv/sv_transfer.lua @@ -13,7 +13,7 @@ function PLUGIN:HandleItemTransferRequest(client, itemID, x, y, invID) end -- Make sure the item is permitted to move between the two inventories. local status,reason = hook.Run("CanItemBeTransfered", item, oldInventory, inventory, client) - + if (status == false) then client:notify(reason or "You can't do that right now.") return end local context = { @@ -35,6 +35,7 @@ function PLUGIN:HandleItemTransferRequest(client, itemID, x, y, invID) canTransfer, reason = inventory:canAccess(TRANSFER, context) if (not canTransfer) then + print("FUUUUUUUUUUUUUU", reason) if (isstring(reason)) then client:notifyLocalized(reason) end @@ -96,7 +97,7 @@ function PLUGIN:HandleItemTransferRequest(client, itemID, x, y, invID) end) :next(function(res) client.invTransferTransaction = nil - + if (res and res.error) then fail() else From afb6687262262c9426b2c45beb1a80c87924ef51 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:54:30 +0300 Subject: [PATCH 47/50] Update sv_transfer.lua --- plugins/gridinv/sv_transfer.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/gridinv/sv_transfer.lua b/plugins/gridinv/sv_transfer.lua index b4ee727f..c8b589f8 100644 --- a/plugins/gridinv/sv_transfer.lua +++ b/plugins/gridinv/sv_transfer.lua @@ -35,7 +35,6 @@ function PLUGIN:HandleItemTransferRequest(client, itemID, x, y, invID) canTransfer, reason = inventory:canAccess(TRANSFER, context) if (not canTransfer) then - print("FUUUUUUUUUUUUUU", reason) if (isstring(reason)) then client:notifyLocalized(reason) end From 9f98c588ee832fe1c273a915e02c97e36aefb6b8 Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Thu, 8 Jul 2021 21:18:46 +0300 Subject: [PATCH 48/50] fix bug that shows players as purchasable doors lmao --- plugins/doors/cl_plugin.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/doors/cl_plugin.lua b/plugins/doors/cl_plugin.lua index 36dc09f4..679bf360 100644 --- a/plugins/doors/cl_plugin.lua +++ b/plugins/doors/cl_plugin.lua @@ -17,7 +17,7 @@ local configGet = nut.config.get local teamGetColor = team.GetColor function PLUGIN:DrawEntityInfo(entity, alpha) - if (entity.isDoor(entity) and !entity:getNetVar("hidden") and hook.Run("CanDrawDoorInfo", entity)) ~= false then + if (entity.isDoor(entity) and entity:isDoor() and !entity:getNetVar("hidden") and hook.Run("CanDrawDoorInfo", entity)) ~= false then local position = toScreen(entity.LocalToWorld(entity, entity.OBBCenter(entity))) local x, y = position.x, position.y local owner = entity.GetDTEntity(entity, 0) From bba0f13fda33babe53ef4cf724339692a69d389f Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Thu, 8 Jul 2021 21:30:26 +0300 Subject: [PATCH 49/50] Tov's an idiot lmao (error fix) --- plugins/doors/cl_plugin.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/doors/cl_plugin.lua b/plugins/doors/cl_plugin.lua index 679bf360..24b95d3e 100644 --- a/plugins/doors/cl_plugin.lua +++ b/plugins/doors/cl_plugin.lua @@ -17,7 +17,7 @@ local configGet = nut.config.get local teamGetColor = team.GetColor function PLUGIN:DrawEntityInfo(entity, alpha) - if (entity.isDoor(entity) and entity:isDoor() and !entity:getNetVar("hidden") and hook.Run("CanDrawDoorInfo", entity)) ~= false then + if (entity.isDoor(entity) and !entity:getNetVar("hidden") and hook.Run("CanDrawDoorInfo", entity) ~= false) then local position = toScreen(entity.LocalToWorld(entity, entity.OBBCenter(entity))) local x, y = position.x, position.y local owner = entity.GetDTEntity(entity, 0) From cd26c973af2f04aff4867694391df347dc0c524d Mon Sep 17 00:00:00 2001 From: TovarischPootis <54110479+TovarischPootis@users.noreply.github.com> Date: Tue, 14 Sep 2021 21:13:30 +0300 Subject: [PATCH 50/50] small optimizing (#82) --- gamemode/core/meta/inventory/sv_base_inventory.lua | 2 +- plugins/playerinjuries/sv_hooks.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gamemode/core/meta/inventory/sv_base_inventory.lua b/gamemode/core/meta/inventory/sv_base_inventory.lua index cff23a0a..412f6e83 100644 --- a/gamemode/core/meta/inventory/sv_base_inventory.lua +++ b/gamemode/core/meta/inventory/sv_base_inventory.lua @@ -285,7 +285,7 @@ function Inventory:sync(recipients) net.WriteType(self.id) net.WriteString(self.typeID) net.WriteTable(self.data) - net.WriteUInt(table.Count(self.items), 32) + net.WriteUInt(table.Count(self.items), 32) local function writeItem(item) net.WriteUInt(item:getID(), 32) net.WriteString(item.uniqueID) diff --git a/plugins/playerinjuries/sv_hooks.lua b/plugins/playerinjuries/sv_hooks.lua index 4b9bf722..01e6bb66 100644 --- a/plugins/playerinjuries/sv_hooks.lua +++ b/plugins/playerinjuries/sv_hooks.lua @@ -38,7 +38,7 @@ end function PLUGIN:PlayerDeath(client) local deathSound = hook.Run("GetPlayerDeathSound", client) - or table.Random(DEATH_SOUNDS) + or DEATH_SOUNDS[math.random(#DEATH_SOUNDS)] if (client:isFemale() and !deathSound:find("female")) then deathSound = deathSound:gsub("male", "female") end @@ -48,14 +48,14 @@ end function PLUGIN:GetPlayerPainSound(client) if (client:WaterLevel() >= 3) then - return table.Random(DROWN_SOUNDS) + return DROWN_SOUNDS[math.random(#DROWN_SOUNDS)] end end function PLUGIN:PlayerHurt(client, attacker, health, damage) if ((client.nutNextPain or 0) < CurTime() and health > 0) then local painSound = hook.Run("GetPlayerPainSound", client) - or table.Random(PAIN_SOUNDS) + or PAIN_SOUNDS[math.random(#PAIN_SOUNDS)] if (client:isFemale() and !painSound:find("female")) then painSound = painSound:gsub("male", "female") end