From the team
Hello everyone! We've been watching closely as people experiment with lua, and have a couple changes towards the lua API.
Besides that, we also have 2 new parts to introduce, and a ton of fixes.
Lua Changes
In the previous version, creating a gadget wasn't too hard, but you had some restrictions when you were designing your gadget or mod.
Your classname had to match your filename, the line numbers wouldn't match up on errors, and some other issues, which is why we changed the lua behaviour.
What this means for you is, if you have any mods/gadgets, you'll need to add 2 lines.
The definition at the top of your file, and the return of your definition at the bottom.
local GadgetName={} --The defintion of your gadget table
function GadgetName:Awake()
print("GadgetName woke up!")
end
return GadgetName -- The return of your gadget table
This is all you'll need to do to get everything updated.
Remember, if you have any issues updating your lua files, make a thread about it, or let us know on Discord!
Controller Compatibility!
We've also included a rather big update to our input system, we've always had some issues with some controllers (some Steering Wheels, Flightsticks, and programs interfering with the inputs like vJoy/pJoy),
which prompted us to update our entire input library.
So far every controller we've tested works great now!
Binding keys and buttons in general is also more consistent, and faster, since inputs that aren't centered will no longer take priority like the previous versions did.
Equation Box
The new magic box that can solve almost any logical issue!
You simply input an equation, and it gives you the wanted inputs and outputs.
You can use it for something as simple as C = A + B, or as complex as combining all the logic of your vehicle into a single block.
There are a ton of built-in functions and variables like pi, deg2rad, sin, cos, tan, asin, acos, lerp, clamp,...
We will have more info about everything included in the Equation Box on our WIKI, including examples on how to recreate already existing logic boxes like a Memory box, shift box, etc.
Router Box
This is a very situational part, you can think of it as a reverse Selector box.
You can insert multiple values in it, and output the one you want, or sort it based on your mode.
A common use-case for this box would be having a collection of distance sensors, and finding which one is closest to a certain value, or return the lowest or highest one of the bunch.
The old way of doing this would be using a ton of Math boxes set to min/max, along with one Combine box.
Or sending large streams of data over a single wire, by using a timer and a Selector box, which wasn't possible in Homebrew previously.
These are the modes you can choose from.
- Select select the input at the index of value. (Like a selector!)
- Least output the lowest value in your stack, along with the index.
- Greatest output the highest value in your stack, along with the index.
- Closest return the value that's closest to the value you're inputting, along with the index.
- Furthest return the value that's furthest from the value you're inputting, along with the index.
Here's a mux/demux example, with the new router on the left, sending data over some Radios to the selector on the right.
Courtesy of Natafish.
Console
We decided to rebuild the in-game console into one that opens as a completely seperate window.
As you can imagine, this is a super handy addition to Homebrew, especially when playing around with lua files, as you'll be able to view any error, warning, or log in real-time.
You can also start a Lua shell to test out lua code right in the console by using the "lua" command!
To exit back out of this shell, you'll need to type "exit()".
This console is entirely separate and you can start a new one from Lua if you want.
Gadget Changes
Some of the gadgets also got some updates with the help of our community!
Changes and Bug-Fixes
Fixes
- Lua Garbage Collection sometimes not triggering
- Lua Garbage tables sometimes not getting de-activated
- Gyrometre compass fixed
- Scrolling to switch gadgets sometimes not working
- Quantum Cube sometimes not spawning, sometimes crashing, etc
- Teleporter making you fall through the floor
- Camera Gadget not taking screenshots properly
- Engines not giving power sometimes
- Scroll speed in video settings UI
- Bullets only being visible when ocean is set to realistic
- HBWheel sometimes giving giant amount of errors on old vehicles
- Mortar not going back to 6 charges
- HBU.Save / Load issues when value couldn't be found or file was corrupted
- Builder input not working when too close to the thing you're trying to select
- Lua sometimes being Garbage Collected when it's not supposed to
- Not being able to enter world vehicles
- Tons of "component is missing script" warnings
- Detachers not detaching when killed
- Memory Box RequireSetValue being ignored in AddValue behaviour
- CoG Issues with Ballast
- Typo fix (Custum to Custom)
- Issue with tutorial Kiosk allocating a lot of memory.
- Some materials that didn't have instancing enabled will instance now
- Guns being able to fire without being 'dropped'
Changes
- Updated QuantumCube Gadget with some new behaviour
- Updated Teleporter Gadget with tons of fixes
- Updated Teleporter Gadget Icon
- Updated Pontoon behaviour to be more realistic
- Updated Empty Enviornment vehicles
- Updated Post Processing Stack with a newer version
- Updated Mortar weight to 19KG from 52KG
- Updated Waves intensity
- Updated Bloom Intensity
- Updated Vignette intensity
- Updated default health to be higher
- Updated Max Bullets calculated for performance reasons
- Added Remainder to Math Box
- Added Version number which auto updates on upload
- Added chat shortcuts for clearvehicles and spawn (/cv & /tp respectfully)
- Added Min/Max on Memory Boxes
- Added Round Type to 50-cal (AP and Sabot)
- Added RGB inputs to Strobe Light
- Added cooldown on Gun behaviour
- Added "HealthMultiplier" server setting
- Added "ArmorMultiplier" server setting
- Disabled lua automatically reloading, you can now trigger a reload by typing "reloadlua" in console
- Disabled Countdown command in General Chat
API-Changes
- OnDamageSent callback added, return values are damage (float) and point (vector3)
- Added HBU.EnableGadgetMouseScroll()
- Added HBU.DisableGadgetMouseScroll()
- Added HBU.TakeScreenshot(path, callbackOnFinished, supersize)
- Added HBU.GetPlayers()
- Added HBU.GetUpdateDate()
- Added HBU.EnableMouseLock()
- Added HBU.DisableMouseLock()
- Added HBU.InMainMenu()
- Added HBU.GetMouseLock()
- Added self.transform to gadgets/modlua scripts
Where do I start with Modding?
You can start by reading up on our Tutorial and API pages.
These will be updated when-ever there's a change, as well as a beta-specific branch.
We would also suggest joining our Discord, as we have a channel specifically for Lua, and API help.
What if I have a problem?
To ensure that no issue is overseen we'll be monitoring steam, Discord and our other channels even more over the course of the following days.
In the unfortunate event that you encounter a bug please follow these steps so that we can release a patch asap:
- See if you can replicate the bug
- Be as specific as possible about the issue, the more information the better. Preferably attach your output_log.txt file which can be located in the HB146_Data folder (right click on Homebrew in your game library, select properties and then browse local files)
- Notify us on Steam or Discord (faster response time)
DREAM - BUILD - ENJOY
Copybugpaste Team