GMod - What are you working on? November 2017 (#75)
191 replies, posted
[QUOTE=happyfaic72;52856978]What can be cooler than two black holes merging? I dunno, but certainly this is pretty sweet.
[IMG]https://i.imgur.com/PftiLU3.gif[/IMG][/QUOTE]
At the risk of having to learn an entire new thing, how are any of those space warping effects done?
[QUOTE=iRyno;52857829]Right now, it's just vector positions - will plan to eventually try and get rooms / room spaces registered.[/QUOTE]
[URL="https://facepunch.com/showthread.php?t=1558948"]Shameless drop of my zones api[/URL]
Just a little something I started on for my Gamemode.
Never done something like this lol.
[vid]http://webm.land/media/P7Cu.webm[/vid]
[QUOTE=Peach;52860141]Just a little something I started on for my Gamemode.
Never done something like this lol. [/QUOTE]
When you click youtube, what if the phone rotated sideways to be a horizontal view?
Also, you might be able to use [url]http://m.youtube.com/[/url] instead. It might load the mobile version of the website.
[QUOTE=bobbleheadbob;52860397]When you click youtube, what if the phone rotated sideways to be a horizontal view?
Also, you might be able to use [url]http://m.youtube.com/[/url] instead. It might load the mobile version of the website.[/QUOTE]
That sounds like an awesome idea. and yeah I tried using m.youtube it detects the OS or some shit ;C
[QUOTE=Peach;52860648]That sounds like an awesome idea. and yeah I tried using m.youtube it detects the OS or some shit ;C[/QUOTE]
use [url]https://m.youtube.com/?app=m[/url] to force the mobile version
[QUOTE=PolygonError;52861038]use [url]https://m.youtube.com/?app=m[/url] to force the mobile version[/QUOTE]
You're Awesome. :3
[vid]https://i.gyazo.com/3717ad696c4b5e1f97dc8df6e844592d.mp4[/vid]
Edit: But now when I click another video it automatically loads other youtube. :\
[vid]https://i.gyazo.com/248e647dfde177d4e5c564547043ad57.mp4[/vid]
Could always append that parameter to the URL.
Couldn't find anything adding glualint to vscode so I gave making my own extension a shot:
[t]https://i.imgur.com/c3PxJaT.png[/t]
If anyone else is interested, you can use it by simply installing [url=https://marketplace.visualstudio.com/items?itemName=goz3rr.vscode-glualint]my extension[/url] and having [url=https://github.com/FPtje/GLuaFixer]FPtje's glualint[/url] in your path. It'll activate for any file opened as lua or glua (the latter is not provided by my extension, I personally use [url=https://marketplace.visualstudio.com/items?itemName=aStonedPenguin.glua]aStonedPenguin's extension[/url] for that)
I'll probably get around to adding a pretty printing and global analysis command later.
Vscode works faster than atom? Atom gets pretty buggy and sometimes really slow, like it's worth the change? Or it's just a visual change like sublime to atom is
[QUOTE=gonzalolog;52863465]Vscode works faster than atom? Atom gets pretty buggy and sometimes really slow, like it's worth the change? Or it's just a visual change like sublime to atom is[/QUOTE]
It's vastly superior to Atom in terms of performance
I want to like VSCode but I feel too comfortable in Notepad++ to change :(
[QUOTE=bobbleheadbob;52863580]I want to like VSCode but I feel too comfortable in Notepad++ to change :([/QUOTE]
What about VSCode makes you uncomfortable?
[QUOTE=bobbleheadbob;52863580]I want to like VSCode but I feel too comfortable in Notepad++ to change :([/QUOTE]
oh my god...Notepad++? I've changed it to sublime
[QUOTE=wauterboi;52863596]What about VSCode makes you uncomfortable?[/QUOTE]
I'm just very comfortable in Notepad++.
I really like the find and replace window from Np++ and I'm really familiar with the hotkeys and menus.
I used notepad++ and found the transition difficult at first. But almost 18 months later, I love and use it all the time. VSCode > Notepadd++
[QUOTE=Peach;52861720]You're Awesome. :3
[vid]https://i.gyazo.com/3717ad696c4b5e1f97dc8df6e844592d.mp4[/vid]
Edit: But now when I click another video it automatically loads other youtube. :\
[vid]https://i.gyazo.com/248e647dfde177d4e5c564547043ad57.mp4[/vid][/QUOTE]
It seems like you're loading the mobile version, but I'd still recommended removing the scroll bars or replacing them with an equivalent that makes the scroll bars disappear after a few seconds from scrolling.
When I switched to Linux I was looking for an editor that was similar to notepad++. I figured notepad++ uses the Scintilla code editing component, so SciTE is close, except it's very bare bones. You can also extend SciTE with Lua.
There's also ZeroBrane which is built entirely in Lua. It's using wxWidgets and the Scintilla code editing component. It's a bit heavy and tries to be more of a lua ide rather than just text editor.
If you really like the simplicity of notepad++ maybe you'll like SciTE if you make some plugins for it. But I honestly don't see a reason to switch if you're efficient in notepad++ and only use windows.
Speaking of tools, my glua "emulator" converts glua to normal lua which could be useful for feeding into standard lua tools. Not sure if it works on windows atm, it did last time I tried.
download [url]https://github.com/CapsAdmin/goluwa[/url]
goluwa cli --glua2lua C:\someluafile.lua,C:\someotherluafile.lua
goluwa cli --gluacheck C:\someluafile.lua,C:\someotherluafile.lua
You can find the source code for the conversion code here
[url]https://github.com/CapsAdmin/goluwa/blob/master/game/lua/libraries/gmod/preprocess.lua[/url]
Honestly I just use vanilla Lua so standard Lua tools don't freak out and because my code will resemble existing code. Garry's change to Lua conventions with new operators aren't my cup of tea.
[QUOTE=wauterboi;52864851]Honestly I just use vanilla Lua so standard Lua tools don't freak out and because my code will resemble existing code. Garry's change to Lua conventions with new operators aren't my cup of tea.[/QUOTE]
I do too for my own code, but when I have some old file open for reference it's nice to not have random errors.
On top of that glualint also warns you about gmod specific things, like deprecated functions
I bear with Atom. It has its issues in terms of starting time but the string/symbol auto completion and fact you can use FPtje's linter probably makes up for it. I'm not sure if there's other editors that have those readily available.
It's awesome to see people are still using and even developing plugins for glualint. It has official plugins for atom and Sublime. Cool that it has one for vscode now too.
For fast startup, similar hotkeys to n++ (I think?) and cross OS compatibility I recommend Sublime. I switched to it from n++ and haven't looked back. Atom didn't do it for me, way too slow in general.
Scoreboard time! Going to support ttt, sandbox, murder and prophunt :D
[img]https://i.imgur.com/BLDDZpl.png[/img]
very wip
Currently [URL="https://facepunch.com/showthread.php?t=1584583&p=52868572"]busy helping other people[/URL] like it is a full time job instead of writing my thesis... oh well.
Since the code turned out quite nice, and you seem to appreciate stencil stuff, I decided to repost it here.
[quote]
[img]https://www.dropbox.com/s/2kjllbekfbglolp/stencil_groundhole.png?dl=1[/img]
[/quote]
[lua]
local MODEL = "models/props_junk/sawblade001a.mdl"
local PLASTIC = Material("hunter/myplastic")
local function findTargetEntity()
for _, ent in ipairs(ents.GetAll()) do
if ent:GetModel() == MODEL then
return ent
end
end
end
--[[
-- Altough the default render library does not provide such a function, I always use something like this
-- with my projects involving the stencil buffer.
--
-- This function essentially makes sure you are not forgetting to change the stencil operations, so other
-- passes will not accidentally "bleed" into your current workflow.
--
-- Also it is nice to make sure you are not overwriting your stencil buffer accidentally.
--]]
function render.SetStencilOperator(compare, pass, fail, zfail)
render.SetStencilCompareFunction(compare)
render.SetStencilPassOperation(pass or STENCIL_KEEP)
render.SetStencilFailOperation(fail or STENCIL_KEEP)
render.SetStencilZFailOperation(zfail or fail or STENCIL_KEEP)
end
--[[
-- A good hook to use for our rendering is PreDrawOpaqueRenderables, as it is called after
-- opaque world geometry has been already drawn, but before any props or entities are rendered.
--
-- Therefore if we modify the depth buffer here, we can make the world geometry seetrough!
--
-- (For a complete list of rendering hooks, and their order take a look at the wiki: wiki.garrysmod.com/page/Render_Order)
--]]
hook.Add("PreDrawOpaqueRenderables", "StencilPlayground", function()
local target = findTargetEntity()
-- Do not attempt without target
if not target then return end
local pos = target:GetPos()
local ang = target:GetAngles()
-- Enable stencil operations
render.SetStencilEnable(true)
--[[
-- It is always good practice to clear the buffer if you are using it for the first time, who knows
-- what odd values are there already...
--
-- Another recommended thing is to restore the stencil write/test mask to the defaults, as the halo
-- library leaves these mangled. This could cause issues when a halo is being drawn before your code.
--]]
render.ClearStencil()
render.SetStencilTestMask(255)
render.SetStencilWriteMask(255)
--[[
-- Set the reference value to whatever you want, the buffer is initialized with all zeros right now.
--
-- Set the stencil operation to always pass, and make the pass operation 'REPLACE'. This means that the
-- pixels we are about to draw (that pass the zbuffer/depth test) will replace the value in the stencil
-- buffer with our reference value. This way our window will not draw over world geometry it is not
-- supposed to. (Opaque world geometry has been already drawn into the buffer)
--
-- A small caveat of this is that we are 'tainting' the render buffer with our window. That is no problem
-- however, as we wish to override those pixels with 'hell' anyway.
--]]
render.SetStencilReferenceValue(1)
render.SetStencilOperator(STENCIL_ALWAYS, STENCIL_REPLACE)
-- Render our 'window into the underworld'
do
local ext = Vector(64, 64, 0.1)
local off = Vector()
render.SetColorMaterial()
render.DrawBox(pos + off, ang, -ext, ext, Color(0, 255, 0), true)
end
--[[
-- At this point our stencil buffer is all zeros, except the places where the window was drawn, and
-- passed the depth test, therefore is visible to the player (not occluded by the world)-
--
-- Change the stencil comparison function to only pass if the value in the stencil buffer is equal to
-- the reference value set earlier. This will ensure that 'hell' will be only visible trough our window.
--
-- (My utility function SetStencilOperator defaults all operations to keep the value in the stencil buffer here!)
--
-- We can also use this test to clear parts of the original buffer. ClearBuffersObeyStencil (as the name implies)
-- clears the currently bound color buffer, but leaves the values intact that do NOT pass the stencil test.
--]]
render.SetStencilReferenceValue(1)
render.SetStencilOperator(STENCIL_EQUAL)
render.ClearBuffersObeyStencil(0, 0, 0, 255, true)
--[[
-- Now that the depth buffer has been cleared, previously drawn world geometry will not occlude
-- anything that we draw there.
--
-- Also, our stencil function is still active, so if we draw our 'hell' geometry here,
-- only the parts visible trough the window will be drawn onto the screen buffer.
--]]
do
local ext = -Vector(1,1,1) * 64
render.SuppressEngineLighting(true)
render.SetMaterial(PLASTIC)
render.DrawBox(pos, ang, -ext, ext, Color(255, 180, 180), true)
render.SuppressEngineLighting(false)
end
-- Now that everything is all done, be nice to the next coder and clear the stencil buffer, just in case
render.ClearStencil()
render.SetStencilEnable(false)
end)
[/lua]
[QUOTE=MDave;52868579]Since the code turned out quite nice, and you seem to appreciate stencil stuff, I decided to repost it here[/QUOTE]
:snip: ocd
Huh, when did this place became so hostile against code style..
[QUOTE=MPan1;52868585]is that a global function i see
[editline]8th November 2017[/editline]
Also
[CODE]
local ext = -Vector(1,1,1) * 64
[/CODE]
[/QUOTE]
Yes. That is a function I put into the render library for good reason. Something like that is long overdue anyway, since you are rarely supposed to change only one of the result operators, especially without changing the comparison function itself.
As for the second unary minus, I am drawing an inside out box sized 64 units, instead of drawing a box sized -64 units.
In the end, I prefer my code to be more descriptive instead of being "correct" according to some constantly changing, and not really agreed upon rules.
[QUOTE=MDave;52868599]Huh, when did this place became so hostile against code style..[/QUOTE]
Sorry. I'm developing OCD
[editline]8th November 2017[/editline]
Also, what map are you running that on? I tried flatgrass and construct but it just looks solid black to me.
[QUOTE=MPan1;52868601]Also, what map are you running that on? I tried flatgrass and construct but it just looks solid black to me[/QUOTE]
Works fine for me on both maps apart some flickering due to the material using the wrong shader probably.
[QUOTE=MPan1;52868601]Sorry. I'm developing OCD and unless the style is identical to Garry's then I will [URL="https://pastebin.com/raw/Qe9AaWGP"]break my keyboard trying to fix it[/URL].
I know it's nitpicky, but I don't think Garry's style has varied since he wrote his first line of code, so I try to use it for everything.
You said your code was nice. It works and has a JavaScript sort of spacing style, but for me if the code does not have Garry's style, then it cannot be nice.
[editline]8th November 2017[/editline]
Also, what map are you running that on? I tried flatgrass and construct but it just looks solid black to me.[/QUOTE]
I appreciate your efforts to keep everyone's code consistent, but your rules are so needlessly pedantic that enforcing them will do more harm than good. And seeing that you've made 150 commits to your code style rules, you really need to make your own guidelines more consistent before shoving them on anyone. Everyone is unique. We evolve. So long as it's readable, optimised, reasonably consistent, and not a total trainwreck; I don't see that big of a problem. Consistency is nice, but ensuring arbitrarily specific rules like perfect spacing is unnecessary.
[QUOTE=coolcat99;52871808]And seeing that you've made 150 commits to your code style rules, you really need to make your own guidelines more consistent before shoving them on anyone.[/QUOTE]
Don't read that rule book mess, it's only for my forgetfulness and junk.
The only thing I actually changed about the code was the spacing, which was meant to make it look more Garry, since it is Garry's Mod.
Also, whenever I add anything to that page it always ends up as a new commit.
If I could collapse commits I would, but I'm just trying to cover every possible situation for myself.
Sorry, you need to Log In to post a reply to this thread.