Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ NutScript 1.2 is the continuation of the original NutScript framework to provide
For a few years 1.1-beta was the name of the newest and most updated version of Nutscript. We are now confident to rename it to 1.2, as the modern stable release of Nutscript.
Nutscript 1.2 is actively worked on by community developers, and will see numerous new updates and features added.

## 1.2 vs 1.2-wip
the default 1.2 branch will always be the stable release. If you wish to test new releases before they are integrated into the stable branch, you can opt for 1.2-wip. Be aware that 1.2-wip may have bugs and issues.

## Documentation
Check out the Nutscript wiki at https://nutscript.miraheze.org/wiki/Main_Page

Expand Down
2 changes: 1 addition & 1 deletion entities/weapons/nut_hands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ CARRY_FORCE_LEVEL = {
-- gameplay purposes
CARRY_WEIGHT_LIMIT = 100

-- I know some people will fuck around with new prop-throwing system. I'm preventing that shit without making it too non-sense
-- Prevent prop-throwing system abuse.
THROW_VELOCITY_CAP = 150
PLAYER_PICKUP_RANGE = 200

Expand Down
8 changes: 4 additions & 4 deletions gamemode/core/derma/cl_dev_icon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function PANEL:Init()
btn:DockMargin(5, 5, 5, 0)
btn.DoClick = function()
self:SetupEditor(true, i)
self:UpdateShits()
self:UpdateIcon()
end
end

Expand All @@ -258,7 +258,7 @@ function PANEL:Init()
self.mdl.OnEnter = function()
ICON_INFO.modelName = self.mdl:GetValue()
self:SetupEditor(true)
self:UpdateShits()
self:UpdateIcon()
end

self:AddText("Icon Size")
Expand Down Expand Up @@ -396,10 +396,10 @@ function PANEL:Init()
end

self:SetupEditor()
self:UpdateShits(true)
self:UpdateIcon(true)
end

function PANEL:UpdateShits()
function PANEL:UpdateIcon()
fagLord = true
self.camFOV:SetValue(ICON_INFO.FOV)
local p = self.prev
Expand Down
6 changes: 1 addition & 5 deletions gamemode/core/hooks/sh_hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,7 @@ function GM:CalcMainActivity(client, velocity)
local animClass = nut.anim.getModelClass(client:GetModel())

if (animClass ~= "player") then
local eyeAngles = client.EyeAngles(client)
local yaw = vectorAngle(velocity)[2]
local normalized = normalizeAngle(yaw - eyeAngles[2])

client.SetPoseParameter(client, "move_yaw", normalized)
client:SetPoseParameter("move_yaw", normalizeAngle(vectorAngle(velocity)[2] - client:EyeAngles()[2]))
end

if (
Expand Down
13 changes: 1 addition & 12 deletions gamemode/core/libs/cl_markup.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
local string = string
local table = table
local surface = surface
local tostring = tostring
local pairs = pairs
local setmetatable = setmetatable
local math = math
local Material = Material
local tonumber = tonumber
local file = file

module("nut.markup")
module("nut.markup", package.seeall)

--[[---------------------------------------------------------
Name: Constants used for text alignment.
Expand Down
4 changes: 4 additions & 0 deletions gamemode/core/libs/sh_character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ nut.util.include("character/cl_networking.lua")
nut.util.include("character/sv_character.lua")

if (SERVER) then
if (not nut.db) then
include("sv_database.lua")
end

-- Fetches all the character names and stores
-- them into a table so they only have to be fetched once
if (#nut.char.names < 1) then
Expand Down
9 changes: 0 additions & 9 deletions gamemode/core/libs/sh_chatbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,6 @@ function nut.chat.parse(client, message, noSend)
local anonymous = false
local chatType = "ic"

--[[
-- fuckoff
-- Handle anonymous/unknown speaker chat.
if (message:sub(1, 1) == "?" and message:sub(2):find("%S")) then
anonymous = true
message = message:sub(2)
end
]]

-- Loop through all chat classes and see if the message contains their prefix.
for k, v in pairs(nut.chat.classes) do
local isChosen = false
Expand Down
20 changes: 7 additions & 13 deletions gamemode/core/libs/thirdparty/cl_ikon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

ikon = ikon or {}
ikon.dev = false
ikon.maxSize = 8 -- 8x8 (512^2) is max icon size. eitherwise, fuck off.
ikon.maxSize = 8 -- 8x8 (512^2) is max icon size.

/*
Initialize hooks and RT Screens.
Expand All @@ -66,15 +66,14 @@ function ikon:init()
*/
OLD_HALOADD = OLD_HALOADD or halo.Add
function halo.Add(...)
-- shut the fuck up
if (ikon.rendering != true) then
OLD_HALOADD(...)
end
end

OLD_HALORENDER = OLD_HALORENDER or halo.Render
function halo.Render(...)
-- shut the fuck up

if (ikon.rendering != true) then
OLD_HALORENDER(...)
end
Expand Down Expand Up @@ -321,22 +320,17 @@ function ikon:renderIcon(name, w, h, mdl, camInfo, updateCache)
file.Write("nsIcon/" .. schemaName .. "/" .. name .. ".png", capturedIcon)
ikon.info = nil
render.PopRenderTarget()

-- lol blame your shit mate

if (updateCache) then
-- it's all your falut
-- you rendered wrong shit
-- if you know better solution, give me to it.
local noshit = tostring(os.time())
file.Write(noshit .. ".png", capturedIcon)
local iconString = tostring(os.time())
file.Write(iconString .. ".png", capturedIcon)

timer.Simple(0, function()
local wtf = Material("../data/".. noshit ..".png")
local wtf = Material("../data/".. iconString ..".png")

ikon.cache[name] = wtf
file.Delete(noshit .. ".png")
file.Delete(iconString .. ".png")
end)
-- make small ass texture and put that thing in here?
end
ikon.requestList[name] = nil
return true
Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/libs/thirdparty/sh_pon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ do
if predictedNumeric == nil then
output[#output + 1] = '[' -- no array component
else
output[#output + 1] = '~' -- array component came first so shit needs to happen
output[#output + 1] = '~' -- array component came first
end

for k, v in next, tbl, predictedNumeric do
Expand Down
1 change: 0 additions & 1 deletion plugins/area/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ else
end

-- draw matrix string.
-- slow as fuck I guess?
local function drawMatrixString(str, font, x, y, scale, angle, color)
surface.SetFont(font)
local tx, ty = surface.GetTextSize(str)
Expand Down
4 changes: 2 additions & 2 deletions plugins/doors/sh_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ nut.command.add("doorsell", {
-- Take their money and notify them.
client:getChar():giveMoney(price)
client:notifyLocalized("dSold", nut.currency.get(price))
hook.Run("OnPlayerPurchaseDoor", client, entity, false, PLUGIN.callOnDoorChildren) -- i fucking hate this life
hook.Run("OnPlayerPurchaseDoor", client, entity, false, PLUGIN.callOnDoorChildren)
nut.log.add(client, "selldoor")
else
-- Otherwise tell them they can not.
Expand Down Expand Up @@ -79,7 +79,7 @@ nut.command.add("doorbuy", {
client:getChar():takeMoney(price)
client:notifyLocalized("dPurchased", nut.currency.get(price))

hook.Run("OnPlayerPurchaseDoor", client, entity, true, PLUGIN.callOnDoorChildren) -- i fucking hate this life
hook.Run("OnPlayerPurchaseDoor", client, entity, true, PLUGIN.callOnDoorChildren)
nut.log.add(client, "buydoor")
else
-- Otherwise tell them they can not.
Expand Down
8 changes: 8 additions & 0 deletions plugins/logging.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ if (SERVER) then
local arg = {...}
return (L("%s purchased the door", client:Name()))
end)

nut.log.addType("observerEnter", function(client, ...)
return string.format("%s has entered observer.", client:Name())
end)

nut.log.addType("observerExit", function(client, ...)
return string.format("%s has left observer.", client:Name())
end)

function PLUGIN:CharacterLoaded(id)
local character = nut.char.loaded[id]
Expand Down
9 changes: 6 additions & 3 deletions plugins/notices/cl_notice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ nut.notices = nut.notices or {}

-- Move all notices to their proper positions.
local function OrganizeNotices()
local scrW = ScrW()

for k, v in ipairs(nut.notices) do
v:MoveTo(
ScrW() - (v:GetWide() + 4),
scrW - (v:GetWide() + 4),
(k - 1) * (v:GetTall() + 4) + 4,
0.15,
(k / #nut.notices) * 0.25
Expand All @@ -17,10 +19,11 @@ end
function nut.util.notify(message)
local notice = vgui.Create("nutNotice")
local i = table.insert(nut.notices, notice)
local scrW = ScrW()

-- Set up information for the notice.
notice:SetText(message)
notice:SetPos(ScrW(), (i - 1) * (notice:GetTall() + 4) + 4)
notice:SetPos(scrW, (i - 1) * (notice:GetTall() + 4) + 4)
notice:SizeToContentsX()
notice:SetWide(notice:GetWide() + 16)
notice.start = CurTime() + 0.25
Expand All @@ -44,7 +47,7 @@ function nut.util.notify(message)
for k, v in ipairs(nut.notices) do
if (v == notice) then
-- Move the notice off the screen.
notice:MoveTo(ScrW(), notice.y, 0.15, 0.1, nil, function()
notice:MoveTo(scrW, notice.y, 0.15, 0.1, nil, function()
notice:Remove()
end)

Expand Down
7 changes: 7 additions & 0 deletions plugins/observer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ if (CLIENT) then
end
end
else
-- Log observer usage
function PLUGIN:OnPlayerObserve(client, state)
nut.log.add(client, (state and "observerEnter") or "observerExit")
end

function PLUGIN:PlayerNoClip(client, state)
-- Observer mode is reserved for administrators.
if (client:IsAdmin()) then
Expand All @@ -95,6 +100,7 @@ else
client:GodEnable()
-- Don't allow npcs to target the player.
client:SetNoTarget(true)
-- Run observer hook
hook.Run("OnPlayerObserve", client, state)
else
if (client.nutObsData) then
Expand Down Expand Up @@ -124,6 +130,7 @@ else
client:GodDisable()
-- Let npcs target the player again.
client:SetNoTarget(false)
-- Run observer hook
hook.Run("OnPlayerObserve", client, state)
end
end
Expand Down