diff --git a/CHANGELOG.md b/CHANGELOG.md index 25a62acd..4bb4aad5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ Changelog --------- The following changes have been made for each official Clockwork build. +0.96.2 +------- + +* Fixed doors not displaying 3D2D info properly. +* Removed theme library debug prints when switching a theme. +* Made the GetDoorEntities function serverside only. +* Gave the PreDrawWeaponList hook the ability to stop drawing the weapon list if it returns true. +* Fixed items removing on think (I.E. removing instantly when dropped). +* Fixed IsMapEntity using entIndex, changed to using the entity itself to check for. +* Fixed fists not playing the knocking noise when the secondary fire is used on a door. + * *Contributed by NightAngel.* + + 0.96.1 ------- diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/cl_kernel.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/cl_kernel.lua index 89cea754..c89ed651 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/cl_kernel.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/cl_kernel.lua @@ -2797,12 +2797,10 @@ function Clockwork:PostDrawTranslucentRenderables(bDrawingDepth, bDrawingSkybox) if (!cwKernel:IsChoosingCharacter()) then cam.Start3D(eyePos, eyeAngles); - local entities = cwEntity:GetDoorEntities(); + local entities = ents.FindInSphere(eyePos, 256); for k, v in pairs(entities) do - local pos = v:GetPos(); - - if (IsValid(v) and pos:Distance(eyePos) <= 256) then + if (IsValid(v) and cwEntity:IsDoor(v)) then cwKernel:DrawDoorText(v, eyePos, eyeAngles, doorFont, colorInfo, colorWhite); end; end; diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/entities/entities/cw_item/init.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/entities/entities/cw_item/init.lua index 7a8de3c6..7e187e51 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/entities/entities/cw_item/init.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/entities/entities/cw_item/init.lua @@ -116,9 +116,9 @@ function ENT:Think() if (type(nextThink) == "number") then return self:NextThink(CurTime() + nextThink); end; - else - self:Remove(); end; + else + self:Remove(); end; self:NextThink(CurTime() + 1); diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/client/cl_theme.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/client/cl_theme.lua index 412152a9..8c2f8fe4 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/client/cl_theme.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/client/cl_theme.lua @@ -365,8 +365,6 @@ end; function Clockwork.theme:LoadTheme(themeTable, isBase) local baseName = themeTable.base; - print(themeTable.name, baseName); - if (baseName) then local base = self:FindByID(baseName); diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_entity.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_entity.lua index 37bece26..b1cc1678 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_entity.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/libraries/sh_entity.lua @@ -65,6 +65,15 @@ if (CLIENT) then return attachment.Pos, attachment.Ang; end; +else + --[[ + @codebase Server + @details A function to get all door entities which are stored from server start. + @return Table A list of all door entities. + --]] + function Clockwork.entity:GetDoorEntities() + return self.DoorEntities or {}; + end; end; --[[ @@ -136,15 +145,6 @@ function Clockwork.entity:GetDoorPartners(entity) return doorPartners; end; ---[[ - @codebase Shared - @details A function to get all door entities which are stored from server start. - @return Table A list of all door entities. ---]] -function Clockwork.entity:GetDoorEntities() - return self.DoorEntities or {}; -end; - --[[ @codebase Shared @details A function to check if an entity is in a specified box area. @@ -1323,9 +1323,9 @@ if (SERVER) then local entIndex = entity:EntIndex(); if (isMapEntity) then - Clockwork.Entities[entIndex] = true; + Clockwork.Entities[entity] = true; else - Clockwork.Entities[entIndex] = false; + Clockwork.Entities[entity] = false; end; end; diff --git a/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_boot.lua b/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_boot.lua index a9f0e0fb..455bd515 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_boot.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/framework/sh_boot.lua @@ -28,8 +28,8 @@ end; Clockwork.ClockworkFolder = Clockwork.ClockworkFolder or GM.Folder; Clockwork.SchemaFolder = Clockwork.SchemaFolder or GM.Folder; -Clockwork.KernelVersion = "0.96.1"; -Clockwork.KernelBuild = "alpha" +Clockwork.KernelVersion = "0.96.2"; +Clockwork.KernelBuild = "beta" Clockwork.DeveloperVersion = true; Clockwork.Website = "http://kurozael.com"; Clockwork.Author = "kurozael"; diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/pickupobjects/plugin/sv_hooks.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/pickupobjects/plugin/sv_hooks.lua index e120f62b..5b0fb9f4 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/plugins/pickupobjects/plugin/sv_hooks.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/pickupobjects/plugin/sv_hooks.lua @@ -112,8 +112,21 @@ function cwPickupObjects:KeyPress(player, key) local entity = trace.Entity; local bCanPickup = nil; - if (Clockwork.plugin:Call("CanHandsPickupEntity", player, entity, trace)) then - self:ForcePickup(player, entity, trace); + if (IsValid(entity) and trace.HitPos:Distance(player:GetShootPos()) <= 96 + and !entity:IsPlayer() and !entity:IsNPC()) then + if (Clockwork.plugin:Call("CanHandsPickupEntity", player, entity, trace)) then + bCanPickup = true; + end; + + local bIsDoor = Clockwork.entity:IsDoor(entity); + + if (bCanPickup and !bIsDoor and !player:InVehicle()) then + self:ForcePickup(player, entity, trace); + elseif (bIsDoor) then + local hands = player:GetActiveWeapon(); + + hands:SecondaryAttack(); + end; end; end; elseif (key == IN_ATTACK) then @@ -126,14 +139,11 @@ end; -- Called when a player attempts to pickup an object. function cwPickupObjects:CanHandsPickupEntity(player, entity, trace) - if (IsValid(entity) and trace.HitPos:Distance(player:GetShootPos()) <= 96 - and !entity:IsPlayer() and !entity:IsNPC()) then - if (IsValid(entity:GetPhysicsObject()) and entity:GetSolid() == SOLID_VPHYSICS) then - if (entity:GetClass() == "prop_ragdoll" or entity:GetPhysicsObject():GetMass() <= 100) then - if (entity:GetPhysicsObject():IsMoveable() and !IsValid(entity.cwHoldingGrab)) then - if (!Clockwork.entity:IsDoor(entity) and !player:InVehicle() and !entity.noHandsPickup) then - return true; - end; + if (IsValid(entity:GetPhysicsObject()) and entity:GetSolid() == SOLID_VPHYSICS) then + if (entity:GetClass() == "prop_ragdoll" or entity:GetPhysicsObject():GetMass() <= 100) then + if (entity:GetPhysicsObject():IsMoveable() and !IsValid(entity.cwHoldingGrab)) then + if (!entity.noHandsPickup) then + return true; end; end; end; diff --git a/Clockwork/garrysmod/gamemodes/clockwork/plugins/weaponselect/plugin/cl_hooks.lua b/Clockwork/garrysmod/gamemodes/clockwork/plugins/weaponselect/plugin/cl_hooks.lua index f2a05a99..bafe737b 100644 --- a/Clockwork/garrysmod/gamemodes/clockwork/plugins/weaponselect/plugin/cl_hooks.lua +++ b/Clockwork/garrysmod/gamemodes/clockwork/plugins/weaponselect/plugin/cl_hooks.lua @@ -95,67 +95,67 @@ function cwWeaponSelect:HUDPaintImportant() end; end; - Clockwork.plugin:Call("PreDrawWeaponList", x, y, weaponLimit, self.displayAlpha); + if (!Clockwork.plugin:Call("PreDrawWeaponList", x, y, weaponLimit, self.displayAlpha, beforeWeapons, currentWeapon, afterWeapons, newWeapons)) then + if (#beforeWeapons > 1) then + for k, v in pairs(beforeWeapons) do + local weaponAlpha = math.min((255 / weaponLimit) * k, self.displayAlpha); + + y = Clockwork.kernel:DrawInfo( + string.upper(self:GetWeaponPrintName(v)), x, y, colorWhite, weaponAlpha, true, + function(x, y, width, height) + Clockwork.plugin:Call("DrawWeaponList", x, y, width, height, weaponAlpha, "before"); - if (#beforeWeapons > 1) then - for k, v in pairs(beforeWeapons) do - local weaponAlpha = math.min((255 / weaponLimit) * k, self.displayAlpha); - + return x, y; + end + ) + 3; + end; + end; + + if (IsValid(currentWeapon)) then + local currentWeaponName = string.upper(self:GetWeaponPrintName(currentWeapon)); + local weaponInfoY = y; + local weaponInfoX = x + 196; + y = Clockwork.kernel:DrawInfo( - string.upper(self:GetWeaponPrintName(v)), x, y, colorWhite, weaponAlpha, true, + currentWeaponName, x, y, informationColor, self.displayAlpha, true, function(x, y, width, height) - Clockwork.plugin:Call("DrawWeaponList", x, y, width, height, weaponAlpha, "before"); + Clockwork.plugin:Call("DrawWeaponList", x, y, width, height, self.displayAlpha, "current"); return x, y; end ) + 3; + + Clockwork.kernel:OverrideMainFont(false); + self:DrawWeaponInformation( + Clockwork.item:GetByWeapon(currentWeapon), currentWeapon, weaponInfoX, weaponInfoY, self.displayAlpha + ); + + if (#newWeapons == 1) then + y = Clockwork.kernel:DrawInfo( + "There are no other weapons.", x, y, colorWhite, self.displayAlpha, true, + function(x, y, width, height) + Clockwork.plugin:Call("DrawWeaponList", x, y, width, height, self.displayAlpha, "current"); + + return x, y; + end + ) + 3; + end; + Clockwork.kernel:OverrideMainFont(Clockwork.option:GetFont("menu_text_tiny")); end; - end; - - if (IsValid(currentWeapon)) then - local currentWeaponName = string.upper(self:GetWeaponPrintName(currentWeapon)); - local weaponInfoY = y; - local weaponInfoX = x + 196; - y = Clockwork.kernel:DrawInfo( - currentWeaponName, x, y, informationColor, self.displayAlpha, true, - function(x, y, width, height) - Clockwork.plugin:Call("DrawWeaponList", x, y, width, height, self.displayAlpha, "current"); - - return x, y; - end - ) + 3; - - Clockwork.kernel:OverrideMainFont(false); - self:DrawWeaponInformation( - Clockwork.item:GetByWeapon(currentWeapon), currentWeapon, weaponInfoX, weaponInfoY, self.displayAlpha - ); - - if (#newWeapons == 1) then + if (#newWeapons > 1) then + for k, v in pairs(afterWeapons) do + local weaponAlpha = math.min(255 - ((255 / weaponLimit) * k), self.displayAlpha); + y = Clockwork.kernel:DrawInfo( - "There are no other weapons.", x, y, colorWhite, self.displayAlpha, true, + string.upper(self:GetWeaponPrintName(v)), x, y, colorWhite, weaponAlpha, true, function(x, y, width, height) - Clockwork.plugin:Call("DrawWeaponList", x, y, width, height, self.displayAlpha, "current"); + Clockwork.plugin:Call("DrawWeaponList", x, y, width, height, weaponAlpha, "after"); return x, y; end ) + 3; end; - Clockwork.kernel:OverrideMainFont(Clockwork.option:GetFont("menu_text_tiny")); - end; - - if (#newWeapons > 1) then - for k, v in pairs(afterWeapons) do - local weaponAlpha = math.min(255 - ((255 / weaponLimit) * k), self.displayAlpha); - - y = Clockwork.kernel:DrawInfo( - string.upper(self:GetWeaponPrintName(v)), x, y, colorWhite, weaponAlpha, true, - function(x, y, width, height) - Clockwork.plugin:Call("DrawWeaponList", x, y, width, height, weaponAlpha, "after"); - - return x, y; - end - ) + 3; end; end;