Garry's Mod Logo
schedule 07 November 2012
Devblog

Garry's Mod - Update 148

I sent an update to Valve. I’m hoping it fixes all the major issues right now - so I can start off merging the latest code and get linux working again.

Here’s a verbose changelog.

Default scoreboard no longer swallows keys

Previously the scoreboard would swallow the keys meaning that you couldn’t walk around with it open. This is now fixed!

Saves and Dupes now have separate tabs

The creations tab has been split into Saves and Dupes. This will allow us to tailor each tab specifically for their contents in the future.

Saves and Dupes are now have custom tags

Saves and Dupes were messy and disorganised. I’m hoping that sorting them into a few categories will clean this up and make them a bit more explorable.

Vehicle third person view offset isn’t weird anymore

Probably most noticeable on chairs and the pod - the third person mode was kind of weird before. On the pod it was completely useless. I’ve made it act a bit more like you’d expect.

Can zoom vehicle third person view with mouse wheel

Something that has been requested for a long time. You can now zoom in and out of the third person mode with the mouse wheel. The zoom level is saved per vehicle - so you can return to a vehicle and it will be at the same level you left it.

Vehicle view mode is recorded in demos

The view mode of vehicles wasn’t actually recorded in demos. This caused confusion when playing them back. The viewmode is now recorded (and is the zoom level).

‘Back To Main Menu’ button now fully clickable

The Back to Main Menu button on the bottom left of the menu sometimes seemed like it didn’t react. It was because it only actually reacted when clicking on the text of the button. That’s been fixed.

Fixed LOD issues with player models

With the recent Scream Fortress 4 update for Team Fortress 2, Valve introduced some code-related changes that required us to recompile all playermodels. Some issues with level-of-detail optimizations slipped by; they have been fixed! Additionally, some additional optimizations for LODs have been added, similar to those used by Valve for TF2. They should help on servers with lots of players at once.

The Breen playermodel is now colourable

As with every update since Garry’s Mod 13, more playermodels progressively get color customization.

Fixed Lua error when loading old saves with cameras

This was manifesting in SetFunc errors in the console. It was caused because the ‘save fomat’ of cameras changed in the previous version - and I stupidly didn’t make it backwards compatible. It’s not backwards compatible.

Re-added support for Entity.Entity

Calling self.Entity in your entities is generally something that isn’t required - because self is the entity. This is something that I assumed no-one was using - but it turns out a lot of people were. So for the sake of compatibility I restored the behaviour. The first time this is used it will output a warning in the console - to encourage people not to use it.

Reverted DForm:NumSlider to previous behaviour

In the previous version I changed DNumSlider to return a DNumScratch. This worked perfectly fine in theory. The problem was that a lot of scripts were counting on the return value of the function. It was also a pretty backwards thing to do.

Integrated DNumScratch into DNumSlider

I still like the idea of DNumScratch - but I decided to put it somewhere less obvious - and not to force people to use it. Sometimes it’s faster to use the notched slider. So you can now use the numscratch control by dragging on the label of a DNumSlider.

Fixed entities sometimes pretending to be invalid

One of the biggest errors in the previous values cropped up due to the optimization I made to the Lua Entity Handle system. It turns out that it was creating the Lua Entity Handles before the actual Entity Handle was valid. This obviously caused a lot of crazy problems all over the place.

Fixed timer logic

There were a couple of problems in the new timer system that didn’t happen in the previous version. Namely re-creating or adjusting a timer while inside the same timer.

surface.SetFont now errors on invalid font

Lua coders requesting more errors! Previously SetFont would just carry on like nothing had happened if you called it with an invalid font. This caused hard to trace errors further down the line when text measuring functions returned nil. SetFont will now throw a nice stack tracable error to catch those problems early.

AddCSLuaFile tells us where it was called

AddCSLuaFile throws an error if it can’t find the file, but it doesn’t tell you where it was called from. This is changed in this update.

gm_video now locks FPS, doesn’t blur screen

I’m sure no-one else uses gm_video. But if you did you’d have noticed how hard it was to navigate the spawnmenu when recording - because the screen was blurry and mis-aligned. This is now fixed. It also locks the fps to the recording fps set in vid_fps.

Fixed engine error when adding a vector and an angle together

This isn’t limited to adding, it’s pretty much any mathematical function between userdata. It’s correct that this should error out - but it shouldn’t be an engine error. It should be a Lua error.

Fixed OnEntityCreated receiving NULL entities on precache

This hook is called when entities enter the Lua system. The source engine creates a version of each entity when creating a game - to precache stuff. Those entities aren’t fully created - so never get a valid entity handle. But they were finding their way into this hook. I fixed that.

Fixed error in DListBox

This was a simple error fix. The error was seen when using the undo menu.

Fixed Entity:CreateParticleEffect

This function can be called multiple ways - but was erroring out when not called a specific way. I fixed the bug and it can now be called as usual.

Fixed jeep not showing as a vehicle type clientside

The clientside Lua system wasn’t aware that the jeep was a Vehicle - so it wasn’t pushed with the Vehicle meta table. I think this has been a long standing problem. It’s now fixed.

Fixed crash on hook error

There were some hooks that expected returns, which would cause an engine error if your script errored during. How to sentence. In previous version of Garry’s Mod this would carry on regardless - and use whatever returns were left on the stack - leading to what can only be described as undefined behaviour. In the current version it throws a “Calling GetReturn on an invalid return!” error - which allowed me to find the problem easily.

Numbers are allowed in the gamemode name

In an effort to thwart the spammy, attention grabbing gamemode names in the gamemode menu I prevented them using certain characters (,./*\#~`¬{}=+_[]().”). I also included numbers - in an effort to prevent people adding v12355 to the end of their gamemode name. This affected a few legitimate gamemodes (HL2:RP) - so numbers are now allowed again

ManipulateBone functions work clientside

Last update the BuildBonePositions hook was removed because it was called too often (drawing the entity, drawing the shadow, getting an attachment, working out bounds), the results weren’t cached in any way. In general it’s bad practice to have a hook like this. These things should be pushed, not pulled. The ManupulateBone functions were serverside only. This version allows you to call these functions on the client, and clientside only entities.. but be warned - any server settings will override the client settings.

ShouldCollide reinstated

ShouldCollide was removed last update for the same reason as ManipulateBone. It was called a lot, and 99% of the time it wasn’t actually achieving anything. Well I’ve been mulling it over - and talked it over with some coders on the forums. The solution we came up with is this. It works the same way as it always did - except that one of the entities needs to have called ent:SetCustomCollisionCheck( true ) - which was added this version. You can check whether an entity is registered for this callback using ent:GetCustomCollisionCheck().

Inflator now clamped at zero

In GMod12 the inflator was limited to 0, so when you made something really small it stopped at 0. In GMod13 it allowed you to go into minus figures. This was throwing some people off - because they were shrinking a bone to make it invisible (to swap heads for example). It’s now back to how it used to be, clamped at 0.