Skip to content

Commit

Permalink
1.2.2. release Merge pull request #83 from NutScript/1.2.2-wip
Browse files Browse the repository at this point in the history
1.2.2 release
  • Loading branch information
TovarischPootis committed Sep 14, 2021
2 parents 725dd74 + cd26c97 commit 4cc6046
Show file tree
Hide file tree
Showing 36 changed files with 793 additions and 388 deletions.
9 changes: 5 additions & 4 deletions entities/weapons/nut_hands.lua
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions gamemode/config/sh_config.lua
Expand Up @@ -30,6 +30,16 @@ nut.config.add("genericFont", "Segoe UI", "The font used to display generic text
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",
data = {min = 10, max = 5000},
Expand Down
20 changes: 14 additions & 6 deletions gamemode/core/derma/cl_inventory.lua
Expand Up @@ -34,12 +34,14 @@ 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))

self.nutToolTip = true
self.itemTable = item
self:SetModel(item.model, item.skin)
self:SetModel(item:getModel(), item:getSkin())
self:updateTooltip()

if (item.exRender) then
Expand Down Expand Up @@ -97,14 +99,20 @@ 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()

itemTable.paintOver(self, itemTable, w, h)
end

hook.Run("ItemPaintOver", self, itemTable, w, h)
end

function PANEL:PaintBehind(w, h)
Expand Down Expand Up @@ -308,20 +316,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)
Expand Down
63 changes: 30 additions & 33 deletions gamemode/core/hooks/cl_hooks.lua
@@ -1,6 +1,6 @@
function GM:LoadNutFonts(font, genericFont)
local oldFont, oldGenericFont = font, genericFont

local scale = math.Round(nut.config.get("fontScale", 1), 2)
surface.CreateFont("nut3D2DFont", {
font = font,
size = 2048,
Expand All @@ -10,28 +10,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
})
Expand All @@ -45,21 +45,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
})
Expand All @@ -69,101 +69,101 @@ 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
})

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
})

surface.CreateFont("nutSmallBoldFont", {
font = font,
size = math.max(ScreenScale(8), 20),
size = math.max(ScreenScale(8), 20) * scale,
extended = true,
weight = 800
})

surface.CreateFont("nutItemBoldFont", {
font = font,
shadow = true,
size = math.max(ScreenScale(8), 20),
size = math.max(ScreenScale(8), 20) * scale,
extended = true,
weight = 800
})
Expand Down Expand Up @@ -286,7 +286,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")
Expand Down Expand Up @@ -345,7 +344,7 @@ function GM:CalcView(client, origin, angles, fov)
view.origin = data.Pos
view.angles = data.Ang
end

return view
end
end
Expand Down Expand Up @@ -387,7 +386,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()

Expand Down Expand Up @@ -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
Expand All @@ -440,16 +439,14 @@ function GM:ItemShowEntityMenu(entity)
itemTable.entity = entity

if (input.IsShiftDown()) then
callback("take")
callback("take")
end

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()
Expand Down Expand Up @@ -505,7 +502,7 @@ function GM:SetupQuickMenu(menu)

local button = menu:addCheck(name, function(panel)
panel.checked = true

if (IsValid(current)) then
if (current == panel) then
return
Expand All @@ -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
Expand Down

0 comments on commit 4cc6046

Please sign in to comment.