#General modding chat
1 messages · Page 2 of 1
Airborne parts were updated, reuploading list
Accurate and includes Airborne DLC Blocks now
thanks to @volvobomb aka VVB for quickly hopping into a multiplayer server to get all the block info
You're amazing
Soo i looked at some of the forums related to the smoothness of cameras not existing
Why is that? Does a smoothed vector not cause correct movement or
Is it due to the current way it gets synchronized to players
Whatever it is, it definitely needs to get fixed 🪦 my spectator camera is brutal without preset positioning of the camera, and speed adjustments
it's because you can only set its position/rotation, which changes it instantly without interpolation due to the camera not being a physics object
Just lower your graphics
Wait why dont people just interpolate manually then
Also for the lagging behind you could just
Add velocity to position a bit
Like source's cl_interp and cl_predict
rq what does this return
tm.UICallbackData
Nothing
Because you can't
why not
You cannot do client-side code, so you cannot make sure that the camera position is interpolated according the the client pc's framerate -- it will always be serverside, and then ending up being somewhat choppy as it will always be teleported on the client-side.
We haven't had the time to investigate this problem yet, but I agree that this is not ideal!
it doesn't, it's just an artifact of how the official documentation file is (incorrectly) formatted
that line should just be local UICallbackData = {}. You don't get it by accessing the tm global table, you get objects of that class as the argument in UI callback functions
also curious why that is impossible, when you could initialize the camera and at the same time send the vector information to a stored value
^
at best you can get 60fps movement, but that won't be syncronized with the client (even if that client is also at 60fps). If the client is running at more than 60fps, you see the sudden changes as the position/rotation updates without interpolation
h
how large is the lag
is it corresponding to the actual latency from sv to cl or
even larger
there might be a way to work around latencies if one had access to server to client latency
again, that's not your only issue.
what else should i consider then
at best you can get 60fps movement, but that won't be syncronized with the client (even if that client is also at 60fps). If the client is running at more than 60fps, you see the sudden changes as the position/rotation updates without interpolation
if the client runs more than 60fps the interpolated information shouldnt be that choppy unless having to interpolate two far vectors
i do know that this might be an issue for the freecam workover
as if you get too fast youll definetly just lag alot
maybe ill pause dev on that one until modding updates
also i hope we get text alignment flags
PLS
#1123915629653667943 please ❤️
make some request, so we can create proper discussion and keep track of them and collaborate with you all on it
it is a good way for us to prioritise features as well, as we can both see how much people want them and discuss implementations and designs of them
you don't have any interpolated information. You set the position/rotation on some frames while you don't in others. As a result, you will see the camera suddenly change on the frames you set the position/rotation and stay perfectly still on the others, leading to the choppiness. There is no way currently to prevent that
and also, please try and follow the proposal template 🙂
https://discord.com/channels/296562030624899072/1123939608464457788
@median cobalt i just assigned you modder role so you can post in there as well
thank you
oh no i was talking about using recursive interpolation to drive the camera position
again, you can't do interpolation currently, in any way. You don't have access to the client's fps
unfortunantly, you might 1 frame get a position from the server that is let us say 20ms behind and then you experience some random lag and then you get the next position and maybe thats 60ms behind.
it is impossible to counter this
i was mainly talking network latency
so all ticks are uneven in that case
I don't remember if the mod updates run in fixedUpdate or engine update.
it's not only latency. The duration of 1 tick in the client and server aren't necessarily the same either, and in the rare case in which they are the ticks aren't necessarily synchronised
im guessing this would not work as intended then
(wanted to add angle but already realized what the forums said so i didnt want to try more)
no, because that interpolates server side. The client will still see choppy movement because the amount of interpolated positions won't match the amount of frames in the client for the duration of the movement
aight well, knowing the current state of modding altogether i think were asking too much of the current features anyways
it isnt as extensively modifiable as the lua im used to
movement has been disabled
it is much more stable now (also correct speed)
when adding meshes, how accurate is the hitbox applied to it
how to get infinitely large worlds in singleplayer: just move everything around you lol
except that only works in singleplayer, in multiplayer attempting to do that quickly becomes a mess

what function should i use when i want to spawn in a static mesh?
either the normal or concave one
I just found out the tri limit is not per mesh but global 
I guess no building of actual full on maps
Does that also apply to prefabs.. Or
there's a tri limit for custom models?
Apparently
Go over it , softcrash
Not even 30k tris
I tried to load a whole 330k but it didnt even load chunk 1
damn that sucks
meanwhile some sm modders be making a 30k tris model for a 3x3x3 block 💀
almost 40k actually
||definitely me at times
||
😕 I have always found it to be per mesh, all of my meshes in total for a mod I've been making (space expansion) have a tri count of 52,195
The games built-in mesh importer sucks, I’ve said this before, No offence to the devs.
yea i tried to make a high detail map
dont work out too well
a 5km² map with 330k just for the base ground seemed too large
why use so many triangles? it's only 5km^2, it doesn't need 330k tris, if you need to scale a texture and have it tile just scale the uv map, and places where it's flat just don't have as many triangles
why so many triangles? because i prefer to not have polygon hitboxes which span 400 metres between vertecies
this (a text gui being added with a directory that doesn't exist as it's default value) will "lock" the game until you reopen the world, disabling the mod does nothing, might post this in #bug-reports later or maybe it's because it's a directory to a non-existing workshop item be dead, assumption!
It’s because the string length is past the set limit I think
I know if you use a string that’s longer than some predetermined limit for UIText, the game crashes
game didn't crash for me
I’m running on wine, so that might cause the crash
I’ll give it a check tomorrow though, might be a whole different bug you’ve found
UI text is never interpreted as anything other than text, so it's irrelevant whether it is a directory or not
ah so it's just length of the text? didn't check that
is there a mod for unlimited complextiy
Yes, but the limit exists for a reason
velocity vector arrow
That's very cool.
That alone as a mod would get you into the hall of fame. I can never tell which way I’m actually going with my creations
It should be on the workshop under the name "Velocity Vector"
Yay
2 of the same prefab in the spawnables list
just orbiting doon, which, is in fact, a sphere :0
(this is a mod for Trailmakers (on steam) ofc lol)
u wut m8
Mod
modom
Modomod
I thought there were 4 skeletons, but they're just duplicates of the previous ones
i cant code but is anyone willing to make a mod that nukes all builds? (for host only)
should it launch an (almost) photorealistic nuke at their builds or just explode them?
just delete them?
if player.playerId == 0 then
tm.playerUI.AddUIButton(player.playerId, "deletebutton", "'nuke' builds", DeleteButton, nil)
end
end
function DeleteButton(playerId)
for i, player in pairs(tm.players.CurrentPlayers()) do
if playerId ~= player.playerId then
for j, structure in pairs(tm.players.GetPlayerStructures(player.playerId))
structure.Dispose()
end
end
end
end
tm.players.OnPlayerJoined.add(onPlayerJoined)```
what? that script adds a button for the host that despawns all builds except the host's
🤔 hmm, deleting players?
if you do make this, seperate button pls
XD
@open acorn is the mod easy to make?
or no?
just wondering?
go to your trailmakers installation folder, then the folder inside called mods (or go ingame, go to session settings, and click on open mod folder) then make a new folder (with the name of your mod) then inside that folder create a text file, and if extensions is not enabled, enable that, then call it "main.lua" then paste in the code above (that is the script, the code is just an example for a script to acheive the desired effect)
no, but it should work
I'm not going to upload it, unless I decide to make it launch an almost photorealistic nuclear missile and have an almost photorealistic nuclear explosion with accurate scaling
sure lol
You know my server utilities has a delete structures button
this is gonna be a far fetch on how i imagine mods to be but
the peak moment for trailmakers modding would be a real full on large map with a capture-territory gamemode in which creations use up a fictive resource dependant on their complexity and can be spawned only on terminals on buildings owned by the territory
the amount of things lua modding can do is insane and i hope we can get to this kind of stuff
even tho thats very far fetched for now
all of that it's already possible in some way
well i still have to figure out why the models didnt want to load in
wait-- do models crash when theyre only pure planes
maybe that was part of the issue
really shouldn't. Just a basic quad you are trying to load?
You only have to add a mesh a once of the duration of the server life. Then the server will automatically ensure to upload that to the other clients as they join.
Ensure you key them uniquely. Otherwise things will break as you try to add a mesh under the same key as another resource. I believe textures & meshes share same resource key names, so also be careful there.
What are the prefab names for The logic-related sensors (Distance sensor, Angle Sensor, Speed sensor, Angle sensor, Compass)?
I don’t think we have prefabs for the blocks (though I wish we did)
I want the names, so I can modify their behavior (analog sensor mod)
Prefabs don't include any of the build blocks. As far as I'm aware mods can't interact with the logic blocks in any way. You could possibly build an analog sensor mod yourself that is based on the player character but it would not be able to be directly added to builds.
Offroad Wheel's internal name is "PFB_StandardWheel [Server}" (" [Server]" is just added due to it being server side code iirc), I think ???? meant something like that but for the logic blocks, for getting the name of a block.
And yes, you cannot modify or get the input/output of logic blocks, nor what is connected to them.
PFB_DistanceSensorBlock [Server]
PFB_AngleSensorBlock [Server]
PFB_SpeedSensorBlock [Server]
PFB_AngleSensorBlock [Server]
PFB_CompassSensorBlock [Server]
@cold knoll
🤔 might try to make this (saved in 2 separate parts, and modded blocks can only interact with other modded blocks and the seat (and the structure itself) (simple enable and disable keybinds if connected or not), though it'll need a new build system
)
but for this I need to figure out a way to convert local co-ordinates to global around a rotation and back (I have basically everything I need for the rest of it in separate mods)
don't say this is impossible, as I've simplified it to a degree that should be possible
tm.input.DeregisterFunctionToKeyDownCallback(playerId, functionName, playerId)
and tm.input.DeregisterFunctionToKeyUpCallback(playerId, functionName, playerId) where?
or is there some other way to deregister a key to a... nvm I just realised I could check if a value was true in the function 
You can also replace the function with an empty one, since you just pass the function name as parameter rather than the function itself
Iirc it will just call both in that case
it shouldn't, since there can't be 2 different global objects with the same name
Well when i was trying to load the map chunks theyre tesselated basic planes with no thickness and tried to load it with a hitbox so
@median cobalt @radiant lion and I were testing it out some time ago (#modding-archive message) where we were writing procedural OBJs to the dynamic folder data and then loading again at runtime - it was just plain quads with no thickness pretty much.
I see in the mentioned posts that normals were required, do you have them? I believe you also had to define the UVs as well, but can't remember right now.
Otherwise, maybe try and post a sample OBJ + code, then we can look a little deeper. Otherwise it is a little hard to know where the issue might be.
When microsoft lets me back in ill get to it
Noooooo!!!!! All I needed was to change the output strength of logic blocks so their output depended on their measured value (etc)!!!!!
What does mod directory mean when uploading a mod?
folder of the mod, aka like mods\Example\
folder directory should include the folder where main.lua is stored as well
too bad we can't do the same with pictures, being able to access steam's texture library would be very handy for that... just saying
(as well as the option to make 3d object out of triangles directly, would skip the annoyingly long loading times)
good luck writting a png/jpg encoder, it would be far better to just have APIs to create simple textures/objects (solid colors/gradients/geometric shapes/etc) at run time
wasn't thinking about making encoders, just procedurally generated textures, for that we can use the API we have rn
you can only load png/jpg files as textures, so whatever texture you generate at run time currently will have to be encoded as a png/jpg to be able to load it (unless you use a completely separate program to procedurally generate all the textures, in which case it's the same as any other texture)
my trailmapers map eddit isnt loading, any idea why?
it gets stuck on this screen and i cant do anything
Which is where unity comes in handy, no encoding or anything, you just create a texture2d of given pixels and then set each pixel one by one, should be that simple
that would require a new API to create the objects at run time, which was my point, although i didn't know unity supported setting the pixels one by one (which was why i suggested simple things that can be created with a few simple parameters and maths, since that's usually supported)
Been a while since I used unity, but I remember using it to make a transparency gradient by setting each pixel, lemme see if I can find it back
yep, can find the resulting textures (one of them, where the alpha gets increased by 1 for each pixel) unfortunately i must have deleted the cs script (what a moron)
found it, this is it if you are interested
public void MakeTexture()
{
Texture2D tex = new Texture2D(3, 256 * 2 - 1);
Color color = new Color(0, 0, 0, 0);
for (int i = 0; i < tex.width; i++)
{
for (int l = 0; l < tex.height; l++)
{
float New;
if (l < 256)
{
New = l / 255f;
}
else
{
New = (tex.height - l) / 255f;
}
color.a = New;
tex.SetPixel(i, l, color);
}
}
byte[] Png = tex.EncodeToPNG();
File.WriteAllBytes(Application.dataPath + "/Image2" + ".png", Png);
}```
block moves with creation, just slightly offset from the original position, but that shouldn't be a problem
why does rotation opposite except Y? probably another weird thing with euler angles, though it won't work correctly with quaternion either, maybe I'm also doing that wrong 🤷♂️
Interested to see where this goes.. I’ve been thinking of trying custom blocks for a while, so it’s nice to see someone actually give it a good shot
what a weird thing: you have to multiply quaternions to add them together, and it definitely works now
ok it now better
Yeah, same thing happens with complex numbers and 2D rotations
ModBlock has same rotation returned by GetRotation as it did outside of build mode, should probably get fixed, but not that annoying of a bug
We already talked about this, use .forward
And .right
I can share the code to get the Euler angled given those vectors if you need
I already have a function that does that, thanks though, I didn't know forward and right didn't have that issue
Btw I think it's right, I know we only have access to 4 of the direction vectors, just not sure if the vertical or the left-right axis
Still, you can get the last one with a cross product, so not a big issue
could someone confirm me this is the current version?
i can't find any multiplayer servers
verifying file integrity brought nothing
it is the current one
any guess why no servers then?
you are on the development backend, remove any launch parameters from steam
oh, makes sense
is there like a -dev launch param?
yes, but it only makes sense to use it if you are either a dev or playing on a closed beta and you are requested to use it
melvin rotate like this in build mode (incorrectly) and melvin rotate like this outside of build mode (correctly), I am using .forward and .right and a cross product into euler angles then into a quaternion for rotation, and outside build I'm just using the structure and block rotation added together because I know it works, what could be the issue then?
how do I get if a reference to a ModBlock isn't set to an instance of an object? checking if it's nil does nothing (it's never nil) and checking if one of it's values (eg. GetPosition()) is nil doesn't work either (error waterfall), neither does checking if it's type isn't userdata (it's always userdata)
I need to get if it is not set to an instance so I can correctly remove blocks from structures that don't exist or make their rigidbodies non-static
You can try .Exists(), but i don't think there is a good way to know other than catching the error
I think unity has a function that just converts those vectors into a quaternion.
yeah, if you pass a vector3 to the API quaternion constructor it automatically converts euler angles, which is most likely what they are doing
.Exists() worked perfectly, thanks
some sort of build mode thing started (just position, select and add for now)
(although everything is relative to the first block of a structure)
I ❤️ the differences between build mode and outside build mode with positions, rotations, ect.
that's probably because outside of build mode you are getting the position/rotation of the weld group the blocks are in rather than of the specific block
I might just have to make a new builder for custom blocks, probably won't have as many problems that way
you will, because there is no good way to do them currently. Many things simply can't be done
this is dumb
Iirc you used two different ways for calculating position inside and outside, couldn't you use the outside one for both? That can probably solve it
I used the same way of calculating position inside builder as outside, that was rotation, I simply inverted the outside position which seemed to work most of the time (it was inverted in builder)
quaternion math is funny
Truer words were never spoken
❤️
.Exists() just happened to stop working (always returning true now)
I fixed this, apparently they're locally based or something with the angle axis multiplication
You just need to think of a quaternion as a rotation from a given starting rotation to a new one, and quaternion multiplication as composition (performed right to left iirc)
how does the custom missiles mod work?
just wanted to test it out, but idk how to use it
oh nvm
in dumb
why does this only set the time once but log the message every tick?
but when i change the time of day in the session options the mod doesnt change it back
It works the first time?
yeah when i start the mod it works
Have you tried toggling the daylight cycle or whatever it’s called. Perhaps the host settings take priority over mods but seems like a bug
no havent tried that
like this?
it seems to not change anything
Sounds like a bug then, it’s not something I’ve messed with yet
Have you tried just adding to the time and not changing host settings, does it work then?
i now have tried to do this, it detects the difference and logs it but doesnt change the tod
that works
Sounds like a bug then
once you set time of day it doesn't need to be set again until you want to change it to something different
But shouldnt this work then?
do you have the daylight cycle enabled in session settings when it doesn't work?
I dont remember but i probaply did. Tho i wont be able to check for the next few hours
ideas on how I could shift a local position to be relative to a different block in the structure without changing world position (outputs different local position but gives same world position, whereas with the same local position it would be offset by some amount)? (local position is relative to rotation and position, just with an offset, like if you parent an object in blender, the objects local position stays the same but the world position does not if you move and rotate the parent)
Subtract the vector from the previous origin to the new origin from the position vector
how does one get a ModBlock's rotation and position when rotated or moved outside of build? (moved on piston, hinge, ect.)
If the get position/get rotation methods don't return the updated values, you can't
Hello
I am having issues downloading mods onto TM, any help?
Specifically, mods do not show up in my mod menu or even my mod directory after downloading mods
make sure you are scrolling the session settings window, there are 2 scroll bars
neutral face emoji
Is it possible to add items to the game with mods?
No
I think this is a little too much detail for a 1 km^2 piece of terrain
decimate on a plane looks.. triangular
Tm will definitely not like that
I think this is better terrain quality for a 1km^2 tile: 1,919 verts
mesh importer is weird, it doesn't like 9 tiles in 1 file, but it likes 9 tiles in 9 files, even loads faster
looks nice
pong
Request timed out.
ping
fire as a prefab when?
tried scaling the ring of fire down to 0 (thought it might bring all fire to the center) but it didn't do anything except make the ring shape less visible
flamethrower effect just throws the flame
Crazy
and EpicJumpSequence did what I wanted the ring of fire to do, it still throws fire upward, just that all the emitters are at the center
oh, the ring of fire could use a circle emitter shape, idk, probably does, and is probably why it doesn't scale
what other things have fire?
that's not a spawnable
What’s the fire for
fire physics mod thing
Is there a mod that lets you co-op a build in build mode with people on the same team as you or jsut in general
no co-op build, this has already been discussed before, it'd be impossible to use the game's existing build system in co-op with a simple mod, and would also be likely very difficult for the devs to implement if it were to be added in an update
Are there any mods that can let you clip more than 1 weld group into each other?
no
Aw man :(
how difficult is it to lay out a checkpoint race in stock map, like treasure island or race island?
depends on who you're asking, overall in my opinion it takes a while so if you don't have the patience it can be difficult
thats what i wanted to know, As I only want to do 2... Sems better for me to look fo someone that already knows... and see what itll take to get one done. Thx m8
Can i make a 3D model and import it as a mesh with a texture and call it a map?
thats what all maps do, yeah
most maps use premade models from inside the game called prefabs, actually a majority dont use any custom models.
🤓
damn sorry just sayin
didnt mean it like that 😭
it usually looks better (smoother and custom textures) to use custom models for terrain (islands, planets, mountains, ect.) however it for unexperienced modders it may be simpler to use the spawnables
where here could be causing this error? it doesn't tell me which line and what it is, other than Object reference not set to an instance of an object.
at Trailmakers.Mods.Api.Proxies.ModVector3.op_Addition (Trailmakers.Mods.Api.Proxies.ModVector3 first, Trailmakers.Mods.Api.Proxies.ModVector3 second)
🔥 + 🚢 = burnt ship
can you explain what that second for loop is doing because i dont get it tbh
idk how that works for checking if the structure is in build mode
it's simple: it doesn't. That whole loop is equivalent to inbuild = true (you are iterating through the same list again, as a result the value of the current iteration in the outer loop will always be found in the inner loop and thus set that variable)
yeah alright then
i thought i just wasnt seeing something but i guess not
seems like he just used the wrong function because this exists
probably
fixed crashing and removed unnecessary (wasn't much) lines and checking if in build works now
yeah I might've forgotten to add "InBuild" to "GetPlayerStructures"
this line here just doesn't want to work at all, it just keeps returning true and messing up the mod causing errors whenever the block doesn't exist
Lmao
Wowww
Does trailmakers modding allow for custom blocks like 1x1 or maybe a sphere to be added?
no
Hello, is it possible to download mods if i have the game through pc game pass?
no
damn that sucks... they should just make the complexity limit a session setting
it's already a thing
When making a server you can set a max complexity, but no, you can't go over 700
Yeah, that's what i was trying to achieve, but i guess i'm out of luck, thx
there is a good reason why the limit is there on the first place. You need mods to remove it because you are removing the safe guards
Sure, but i'd say a warning before increasing the limit would have the same effect and grant this to everyone, not just steam players
again, there is a good reason why the limit is a thing. Going higher is not officially supported, and putting a warning wouldn't make people not complain about it (specially on play station where it could lead to saves being deleted)
sphere: eyeball decoration
short answer: no
long answer: not with the existing block system
does there happen to be a list or some place that has the update in which each of the modding features were released?
I can find the 1.7 patch notes but not 1.6 and the other versions
spawnables and audio would also be nice, I do have a pre-airborne docs log from the documentation mod, and my alldocs mod from before the new spawnables were added (and audio if audio was added)
I might still have the full logs of some older versions
Gimme a bit and I'll check for ya
this is the spawnables list from before 1.7 spawnables were a thing
pre-airborne docs
ooh, one of my mods from before airborne for some reason logged the spawnables
don't know the update, you just get the dates
august 2022
august 2023
october 2023
might have one more on the other pc but i can't get you that rn
february 2022 in a test branch (a followup to high seas), i made alva run the mod
new documentation in 1.6
new documentation in 1.7
dofile not working
oh nvm it has to be in static
now despawn structure in button function is not working 🤔
You are attempting to call something that isn't a function
idk 🤷♂️
everything else works fine, just that when I press the button I get error and structure does not despawn (structure is there)
define the function before you call AddUIButton. You are most likely passing an undefined value there since the AddUIButton call happens before the function is defined, meaning you are passing nil as a function parameter
oh 🤦♂️
how do i get the force of a jet in newtons. the block.GetJetPower() doesnt seem to return it in newtons
Not sure, but try making a small rig with a thruster while also using AddForce, when it's balanced you'll now the ratio of that to newtons (addforces uses newtons, quite sure)
units are 5kg * m/s²
I was considering the unit returned by the GetMass
ok thanks
do mod raycasts intersect a convex or concave mesh if I have it set to be a concave mesh?, this is what I've observed with the mouse position, so just curious
I love how half of this chat is just alva responding "no" to random modding questions
Fr
Alva grows more and more tired of the community every day
How would I get the position of a specific type of block? for example, if I wanted the x, y and z coordinates of all dynamite blocks, what would I do?
Iterate trough all blocks in all builds of all players and if the name matches with a dynamite you get the position ecc...
thank you. (I am new to this, so I didn't know you had to check all blocks manually)
If ya got any more specific questions on what I said feel free to ask
I'll keep that in mind. 👍
every hour lets be real
bye https://discord.com/channels/296562030624899072/1199540322997383319
(probably offensive to moderators and devs, and probably also why it was removed, or that it was lacking information, or too much of a request and not basic)
Same reason why single suggestions with unrelated ideas are deleted from #suggestions
unrelated?
Yes. It also didn't provide any of the requested information in the template
oh, unrelated as in each idea/request deserves it's own post?
Yes
I didn't see this as it was closed and didn't appear for me at first
would it be suitable to split it into Physics related functions, Block related functions, Structure related functions and Player related functions? it would be a lot of posts if I had to post each concept individually (description and use case added below functions)
Split it into separate functionality that can be used/wanted independently
Some of the suggestions are already in vote modding btw
Interact with chat
Also somewhere the devs discussed about setting transform of modstructure, I can't remember where though
Nvm this is all I can find
gyatt damn
also get cursor position
What is the acceleration due to gravity in Trailmakers? is it 10 or 9.8?
idk but the value of gravity is 14, in unity by default it is 9.81, so it's probably 14
Alright, thanks
Is it possible to create an object such as a sphere which doesn't have collision or physics to mark a 3vector location?
I need to mark specific coordinates dynamically
yes, you can load assets with fixed positions and no collisions (although no collisions works poorly and instad always pushes you upwards)
Ok thanks, I will look into it. 👍
idk if this is a bug. I can't activate a modded camera if I'm in a seat. Is it supposed be like this and even if it is it would help to still changing it to so the camera can be still activated.
orbit camera is incompatible with modded cameras
I hope the @defvs fix that in 1.8
Is there any way to detect creations with the box triggers?
Or do i have to make a custom implementation of some sort
As far as I know no
local structure = tm.players.GetPlayerSeatBlock(playerId).GetStructure()
end```
though this is only indirectly, so yeah a custom implementation if you want more than just the creation the player is in
local structurePos = structure.GetPosition()
if structurePos.x >= boxtrigger.pos.x - boxtrigger.scale.x and structurePos.x <= boxtrigger.pos.x + boxtrigger.scale.x and structurePos.y >= boxtrigger.pos.y - boxtrigger.scale.y and structurePos.y <= boxtrigger.pos.y + boxtrigger.scale.y and structurePos.z >= boxtrigger.pos.z - boxtrigger.scale.z and structurePos.z <= boxtrigger.pos.z + boxtrigger.scale.z then
--some code here for when inside trigger
end```
I just find it funny how the triggers cant detect the very thing the game is about
like dude
sphere trigger slightly shorter
local structurePos = structure.GetPosition()
if tm.vector3.Distance(spheretrigger.pos, structurePos) <= spheretrigger.scale then
-- some code here for when inside trigger
end```
If i spawn a structure, do i get a reference of it?
the structure id
because then i could check only that which would improve performance a lot
i see
so something like
tm.players.SpawnStructure(-1, "blueprint", "onlyBlueprint", tm.vector3.Create(0, 301, 0), tm.vector3.Forward())
local structure = tm.players.GetSpawnedStructureById("onlyBlueprint")```
to spawn a blueprint with modstructure
Does spawnstructure really not return the structure?
That only works for box triggers aligned witht the coordinate axes
forgot rotation existed
Do note,it returns a table with all structures of same id
local structure = structures[1]
Ye, tho I also mean that you can just assign all structures to the same id if you don't need to differentiate between players
yeah that sounds good
i dont need rotation so it should be fine
(you will need to modify your code to iterate through the result instead of iterating through the IDs and call the function inside the loop)
doing that should result in a:
Structure with id <id> already exists.
Then why does it return a table? (Might be wrong, but I remember terror having trouble because he treated it as a build)
If it gets split?
definitely returns a table
table.
a "structure" is a list of smaller structures that together makes a big structure
multipart build vs mod
Not a weld group, I'm guessing
Just when physically separated
list of modstructures, element 1 is the entire 1st structure
how do I get element 2.. oh, detacher blocks or destruction probably
ive been fed lies.... 😭😭😭
hm... text overflow
could it just tell me where the fucking error is
i think that would be pretty neat
it can't because that error comes from the C#/Unity functions implementing the API rather than from lua, and those have no idea about your lua code. The error it gives (System.NullReferenceException: Object reference not set to an instance of an object) does tell you that the function is receiving a NULL reference as input when it was expecting a non-NULL reference to an object, which means you gave an API function a nil value in your lua code when it was expecting a non-nil value (likely expecting a specific API type). If you have a proper IDE setup with the official documentation file/my library version, the IDE should be showing a warning with a type error where it happened (since all functions expecting non-nil parameters are annotated as such)
im really not sure what the issue is here
it prints the text fine, so the value is not nil, yet AddLabel still errors with a null reference
and thats the only time i ever use the AddLabel function so thats the one erroring out
maybe id is nil? i wrote this code ages ago and it used to work fine
i doubt that the devs have changed uicallbackdata either
is that code inside of an UI callback function? If so, print the id as well
just checked, a nil player id for the UI functions gives the error cannot convert a nil to a clr type System.UInt32
the first time the function is called its fine, but the second time it dies
is that the entire function?
no
and this is option click
my original copy of the script seems to work fine so maybe i messed something up in this new version
are you sure the setDialogue function is the one causing the error (execution doesn't reach the end of the function's body)?
thats the only function thats referenced in the long error
its really weird
when i get the error the entire game "freezes", its like stuck in time
i cant move
i have to go back to the main menu
seems like its stuck at model loading now
added some more prints for the options and yeah that seems to be it
it only gets to the AddUILabel print
can you send me the code file?
theres some model spawning going on so youll have to remove that
The issue seems to be that the dialogue texts are too long
iirc when that happens the text should be just cut off
Yes, thats the issue
now it works
i can get through the entire dialogue now
devs please fix
it does cut off
but it seems like its only visual
it happens to all widgets, because after i reduced the size of the label, i got an error for AddUIButton
after reducing the size of the button text as well, everything is good
for me the error is Value "That sounds a little dangerous. Sorry, but I would rather skip this." is longer than the allowed length (max. 64 characters). It also crashes the game, which definitely shouldn't happen even if you go above that limit
alright yeah i see
for me the game only "soft crashes"
as in everything but the graphics freeze
after that i can go back into a map and everything is fine
i still get a null reference error though so thats weird
for me it's an instant oh no
every copy of trailmakers is personalized
maybe it's because i run the game under proton
how are you triggering the UI? i had to add a call to triggerNpcDialogue(0) to the end of the player join function
theres a little guy that spawns with a trigger around him, if you enter that the dialogue will trigger
but you dont have the models so yeahh
he is very handsome
i could zip up the mod if you want
you don't have to, the call to triggerNpcDialogue(0) should give the same result. I don't know why you get a different error though
whoever will have to investigate this issue is in for a world of fun and happyness 🙏
well anyway
i need to rework the ui a bit anyway because of the text overflow on widgets
so that should eliminate the crashing issue
that works
is there any way to make custom objects less reflective?
Lower the alpha in the texture
ah okay
what does the json library deserialize null as? i tried printing the value but i get this
checking if the value is nil doesnt work
why is this print function so bad
i genuinely cannot check what the fuck the value is
It's a specific value from the library. Iirc there is a function to check if it's null
ah yeah i see
the text is now in the middle for some reason? i didnt change anything
Anyway here's what ive got so far
https://youtu.be/mtt_-eFCnQM
i should probably integrate an actual map loader into this
I also made a saving system so quests get saved and whatnot
that happens when you collapse and re-expand the UI
is there any way to undo that or is it permanently like that lol
i restarted the map and its still like that
iirc should reset with a restart, otherwise it's per mod due to the UI state being saved
ah okay
finally got block to not cause errors when it's parent gets destroyed 
sweet
can someone tell me, wtf that mod is
the one in the bottom right?
huh
rotation
colo||u||rs
colours is the correct way to spell it.
block is lookin cool
NOOOOOOOOO
Ye why is its thumbnail that damn weird bruh
idfk, chinese are weird probably
@hoary skiff this true?
thy end is now
is it possible to use RegisterFunctionToCollisionEnterCallback on any game object?
or only box triggers?
it takes a ModGameObject, so it should work on any
guess ill just have to try lol
it works on any gameobject
so you could make custom blocks have health technically
*slightly rolls in the direction the block is on the wing*
*block is now dead*
also idk if projectiles trigger the collision enter callback
first time using dofile wish me luck :333
well, hopefully
needs to be in data_static folder
oh
.lua does not need to exist
first feature of 1.7 I showcased in youtube.com/watch?v=1Oy2OyrPhkM
yeah now its good
I wonder, does dofile run the entire file for the 1 frame or does it sort of add onto the existing lua file.. so one can dofile when the script loads and interact with the functions from that script in the main script
I got my answer 👇
you dont :3
dofile runs the script in a separate scope. Globals are shared across files, but locals aren't (even if defined outside of functions). It's good practice to declare everything locally on files, and if you need to return something create a table, add the elements you want to return to it, and return that table
i was thinking of saving a preset of the blocks but im not sure how youd save what block to attach your blocks to
I guess I could save the parent block local positions to the file in place of the parent block then iterate through all blocks (only when load) and if they're the same that is the parent block
Example:
library file:
local M = {}
local var = 0
function M.dostuff()
var = var + 1
return var
end
return M
main script:
local library = tm.os.DoFile("library")
tm.os.Log(library.dostuff()) -- Prints 1
tm.os.Log(library.dostuff()) -- Prints 2
🤔
ModStructure.inverseTransformPoint(ModVector3) when?
nvm, the blocks know what they need to be parented to at all times, forgot I added that, now I can safely forget the need to store parent blocks
thankyou raycasts for existing
can i just do quat * vec3 to rotate the vector by the quaternion or do i have to make a function for that?
nope
you'll have to make a function for that
no, because that operation isn't defined mathematically. You need to do q * (vec3, 0) * q^-1, then extract the x,y,z components
---Rotates a vector with a given rotation
---@param rotation ModVector3 Euler angles defining the rotation
---@param vector ModVector3 Vector to rotate
---@return ModVector3 # Rotated vector
local function getVectorRotation(rotation, vector)
local q = tm.quaternion.Create(rotation)
local qInverse = tm.quaternion.Create(-q.x, -q.y, -q.z, q.w)
local p = tm.quaternion.Create(vector.x, vector.y, vector.z, 0)
local pRotated = q.Multiply(p).Multiply(qInverse)
return tm.vector3.Create(pRotated.x, pRotated.y, pRotated.z)
end
also, note that you're going to run into many issues using the game's existing builder, though I'm sure you already know that
thanks
how come both of them use the seat as a parent and also use the same offsets and everything yet the result is different
🤷♂️ trailmakers logic
do wheels not actually rotate? lol
wheels are probably just visual rotation, it's unlikely they actually rotate as wheels
ig the wheel model has an empty parent or something
Nope their hitbox also isnt a full circel but instead a lot more blocky. And because of that your wheels wont work very well when you rotate them 45 on your car or such
hmm, could be raycast based
like a raycast in all directions except right/left and repell it by the tire pressure
interesting
huh, for some reason it just doesn't want to save the localpos and rotation, or is it nil, and the json serialization is ignoring nil values? it should be null from what I've experienced making maptrail so idk what's going on here, or maybe it really is a nil value and the table thinks it doesn't exist so ignores it, idk
no, otherwise they would have to split weld groups
it is, they have no hitbox and instead rely on a ring of forces
the json functions are generic and thus don't know how to deal with userdata values (which is a type for objects defined externally from lua, the only thing lua knows is that it's a reference to raw memory). You need to serialize those manually first when storing them on the table
oh forgot I have to convert the vector3s to string first 🤦♂️
clean texture 
tm.os.Log(string) exists?
yeah? tm.os.Log
ik lol, just forgot I could use that to know which functions are running when
docking the log file at the bottom of the vsc window is very nice
omg i got it working
it works
gets called when i press e
i could bind it to any other key
left mouse click
saving and loading seems to be working.... other than it not deleting all the custom blocks in the structure before loading
which occasionally results in double-melvin
like as if a non-existent return function existed here
right mouse click (impossible)
add more force, in the thousands
doesnt work no matter what lol
a multiplier of a million should do it i think
but it doesnt
🤷♂️ neither does my block removing loop
so yeaa you can script blocks somewhat
tbh i have no motivation to figure out positions and whatever, but if you want we could combine my script system with your blocks
I'm almost finished, just need to figure out why it's only removing the 1st block when loading instead of all of them
this is the code for it, right?
that worked
sweet
@open acorn did you account for blocks despawning when the creation is respawned?
blocks remove themselves if no parent structure
they can just load in the modprint again
alright
added keyup and keydown to the input system
is there a smoke prefab of some sort?
scale 0 crashedmayorplane
relative to rotation yes
not directly upwards

looks shit but yeah

yeah, because it's data generated by users
does it save to all clients' userdata at once or just the host, probably just the host
just the host, because mods are exclusively run server-side
so yeah, in multiplayer only the host can save your custom blueprints
build stealers but worse.. they steal half your blueprint (only the modded part) and you're directly funnelling the blueprints to the host
Now I remember why this does not work, characters don't get along with triggers very well
cosmetics mod?
Its not really possible though because of characters colliding with triggers
So many issues similar that need fixed that could make a big difference
could we gather them and put them in a modding suggestion or something?
"Also those damn colliders, it is rather complicated work that has been postponed.
Long story short; client side and server side colliders matrices are finnicky in Trailmakers and we need to be very sure that things are genuinely disabled all around probably." 😐
it is kinda upsetting yeah
transparent textures would also be nice, I have honestly hever had any issues with SetIsTrigger other than that one chirpo
yes, yes it does
It has never worked for me
definitely can't be concave mesh else trigger just doesn't work because unity says no
weird
If I spawn a custom object using "tm.physics.spawncustomobject()", how would I modify the object's position after it is spawned?
Additionally, would I be able to modify the custom object's size?
get the transform of it
Yes, you can, as long as you store the tm.physics.... somewhere, so
something=tm.physics....
Then you can do something.GetTransform().SetPosition(pos)
SetScale for size
Yep
Thank you, I've been using a pretty bad workaround of despawning and spawning in the object, so this should remove all flickering! 🙂
you should take a look around the documentation file. If the return type of a function isn't nil and you don't know what it is, chances are it's an API type you can search for in the documentation to know what you can do with it
RGBird
what
Are there any issues with creating ModGameObject arrays? Mine isn't working quite right and I would like to make sure that you can make arrays of ModGameObjects before I waste more time testing my code...
there should be no reason why you can't
I often store them in arrays with no issue (trackmaker mod and rid's trailedit)
what issue are you having?
Thank you for the insights, I have decided to convert the arrays back to regular variables, to check for other bugs, and if the problem arises again, I will rewrite the code...
Values becoming nil after the function is called a second time...
what function?
A custom one which either places a modgameobject or moves it to a input location
well we cant really debug it without seeing it
actually
I think its a bug from not returning a value in the function
I think I can fix my code.......
cool
(I fixed it)
chirpo animations and mesh layering funny
Nuh you chinese, cant change my mind. To change it you gotta tell me what country you are actually from xD
Making this kind of city as a map would be so epic... @jagged aurora you do that xD
Someone should make a script for spaceship frfr
@dusty umbra found a couple bugs with mod functions you might want to know, wasn't sure who i should tell, so you have been selected :)
- when dragging a block, according to the build menu it's selected, but according to mods they show no blocks being selected (you gotta deselect and select again), this with
tm.players.GetPlayerSelectBlockInBuild(playerId) - when changing the color with a mod the build isn't saved, aka, if said colored piece gets broken and you repair it returns to the original color (of course you can get around this by editing anything else after messing with colors, but it requires people to know to do that)
Videos that make more sense of what i am saying are coming soon
Is it possible to add a force to an object at a position?
If not then ig ill have to math it out
I think you have to math
Have fun understanding how to calculate both force and torque properly
n
_ _ o
in unity yes, but not in the modding api 
😭😭
devs pls make a lua version of an already existing unity function 🥺
--- @param position ModVector3
--- @param x number
--- @param y number
--- @param z number
--- @return nil
function ModGameObject.AddForceAtPosition(position, x, y, z) end```
```--- Add a force to the block at a position. See https://docs.unity3d.com/ScriptReference/Rigidbody.AddForceAtPosition.html
--- @param position ModVector3
--- @param x number
--- @param y number
--- @param z number
--- @return nil
function ModBlock.AddForceAtPosition(position, x, y, z) end```
```--- Add a force to the structure at a position. See https://docs.unity3d.com/ScriptReference/Rigidbody.AddForceAtPosition.html
--- @param position ModVector3
--- @param x number
--- @param y number
--- @param z number
--- @return nil
function ModStructure.AddForceAtPosition(position, x, y, z) end```
hmm, unless structures and blocks are handled differently to rigidbodies, which they probably are
considering peter existed at some point
The annoying thing is; We have proxy classes for unity classes. As we can never "just allow the feature". This is pretty much the way that MoonSharp works.
Simple function calls might have to be re-written as we have to ensure they work in the right context that you expect it to work.
Such as, when you get a ModGameObject of a block. If you invoke the Transform of that block, is that the root transform or maybe something completely else? Our hierarchies is not always as straight forward as one might expect.
So most of the case when you get a new function API to an object; then it is because we had to write some code (and test it).
I know that much, I meddled a bit with the API code when dll modding was a thing
I completely sympathise with the.. "This feature is just a simple function" call. But unfortunately. we are missing a ton of features for every proxy class. And ALL of them needs a proxy function to call that function. It just takes time and every function needs to be QA'ed.
It is coming, slowly, steady, and hopefully sooner than later. And it always helps when you say "hey we need this function" instead of a whole damn class. But I would say you are all really good at that, so hopefully that can helps us accelerate specific things that you need.
yeah, it is understandable, it wasn't a "Don't allow us to use them" in term of "they are evil" more of a "it's not available", i do know that you also got some other stuff to worry about that involves more then the few people who use mods
And I didn't mean to be defensive haha; just wanted to give a little insight on the challenges that we face on basic (and existing) functionality.
well, while you are here in range of being annoyed
could you take note of that second one (don't want to seem needy) just i see a bunch of people having problem with stuff resetting
am asking just to take note, it's not like there even are many mods that even use the setColor function
I am unsure whether we can do that without actually having to make persistent changes to the blueprint itself.
Without knowing; when repairing it might just check the saved blueprint to repair. So in order to do so we would have to save the new color to the saved structure... Which sounds super bad.
I don't have a good scope on the issue, but I'll write a task to investigate.
oh... well, that seems a lot more annoying that what i was hoping for
It might be a lot easier and that we can just recover the blocks+mod colors from the destroyed structure. But if that's the case; I am unsure why they "reset" their color in the first place.
yeah, i doubt that's how it works, i was hoping more that the process to save a build was... simpler
Could you potentially walk me through what you were expecting just so I ensure I don't misunderstood you?
i am probably very wrong, but i expected the saving code to be something like:
When something gets edited > calls a "save" function (that would save all of what is in build mode)
So then you could just call that save function after the new colors get applied
but according to what you said it seems a bit less straightforward
I did write "without knowing" because I don't know myself how the blueprint system work; But coming back to that; my question is,
Would it be ok for a mod to change the blueprint?
i don't think i'm allowed to decide that
Just an open design discussion. Not a decision 🙂
That's usually what this channel is for
then i don't really see why not, you can already save builds with edited colors and i think this should only impact the recent blueprints (as the ones in the recent tab)
Well that ensure that the player consents to these changes right?
i think so, none of these changes are permanent if the player doesn't press the save button (i am considering blueprints in the recent tab as not permanent)
i guess it could be used to "ruin" a build if you fully repaint it before the player saves it/exits build mode
chat what if we had a function called tm.os.deleteSystem32 that would delete system32
windows users will be upset
So nothing changed
Hi, been sick but back now.
- I will note this down.
- This is not really surprising, when I was trying to get dynamic color changes in (which was too problematic to get greenlit in the current version) I noticed these issues, but it's quite complicated.
So, the fix will probably to try to solve all the problems with the dynamic color changes than fixing the static one in the builder unless they are really important, so let me know.
I'll just make sure to tell people to edit the build after they change the missile settings, that should fix most of it (I noticed a bunch of people, like yzuei, complained about the settings getting reset), if it's complicated then it's not worth the effort (I would rather see that time spent on more used stuff, there aren't many mods that change colors, even less that actively expect you to destroy said blocks)
hey i dont have any knowledge about mods in trailmakers what do i need to begin. Am i even in the right channel here? Where do i get informations?. Is there some kind of API? Thanks in advance
#765571426937733130
uses lua and the trailmakers API, main.lua is the main script that'll be run, mods are folders inside your trailmakers folder's mods folder
#765571426937733130 for more information
ok thanks
I recommend looking at the premade mod, they are simple enough to be used to learn the basics
camera not activating anymore after reloading mod/reopening world
yes the function has been ran (multiple times)
why does this not work
literally worked just a few minutes ago, unchanged
I could be wrong as you said it initially worked, but I thought in pairs() needed 2 variables? eg for i, v in pairs(data) do
v is just a reference to the value of data[i] (i being the index), it does not need 2 variables, only 1, however a second one is used as a reference when it does exist
🤦♂️ I had maptrail open (which uses custom cameras), and the maptrail camera was deactivated but it did exist, removing that mod fixed the issue
interesting how activating/deactivating cameras is only for the current mod's camera, however addcamera cares about other mods' cameras
ye, there can only be 1 camera per player, and several mods wanting to make one which creates issues
how about one camera per mod per player 🥹
You could probably do Dictionary<modId, Camera>
Technical reasons, if several cameras are active, we don't know which one to use etc and they would conflict, so it's 1 per player.
If 2 mods tried to activate a different camera for a player at the same time, which one should be used? Obviously the game can't use both at once, but since there is no reason to prioritize one mod over another the game can't decide which one to use
well yeah
but i think you should be able to add the camera at least
If theres already an active camera when you try to activate another, then throw an error or something
just ignore the proceeding camera activation from mods after the first
then if that one deactivates go to the next activated one, ect.
would it be possible for two mods to be interfering with each other? if i use my missile mod standalone it works, if i load both that and the workshop version none work (they have different settings, so it's not like they are doing the same thing, but opposite)
Might be, the first one that loads first will create it, both can move it, deactivate it etc
thing is technically they should be acting on different blocks
one is working with the eyes, the other on the pipes, tho i'm starting to think it's my fault, rn the workshop mod just doesn't want to work
stuff makes no sense, it worked fine yesterday
i'll just ignore this and hope it doesn't propagate to the current version
hm, uploaded a fresh version and it sill seems to behave weird, i'll do some more testing later
🕷️ Bug report! 🐛
wheel deformation only registers the convex mesh of a custom object which can lead to weird situations like this
heh, clones
bone
my mods (both missile and trackmaker) disables transformation, just by turning it on once it gets disabled permanently, can't find other mods that do that, anyone knows why that could be?
scratch that, i'm a moron, it's disabling any mod that cause that
thats interesting
oh that is actually a bug looking at the code now
hover car 
half hover car
a bug is looking at the code? 
(oh no I forgot to turn off ping
)
Ye I noticed it sounded weird but didn't bother editing it, I'm Swedish, I blame that
Could you send the mod?
it's any concave mesh that the wheels act like this but okay
Thanks, it's logged 🙂
Is there a way to make guns deal more damage or have a faster firerate?
no
Dam I was jsut about to ask something similar
You might be able to artificially, don't remember if you can spawn a bullet or not
||custom bullets require to be made||
using a custom model, that moves forward and raycasts each tick then spawns a seatdeath explosion if the raycast is true at the raycast position with the scale of the explosion being the damage
So no PFB_Bullet sorts deal?
If we had AddForce on objects it could be made without having to manually change position, but iirc that's still not a thing
Devs removed that 💯
I think we have that now
ModGameobject.AddForceImpulse(x,y,z)
ModGameobject.AddForceAcceleration(x,y,z)
ModGameobject.AddForceVelocityChange(x,y,z)
ModGameobject.AddForce(x,y,z)
1.7 spacebound update funny
when the api doesnt have vectors
no
🕷️ Bug report! 🐛
wheels interacting with trigger objects
Where are the trigger objects exactly
the rain is around the player for a few metres, so the car would be inside it
oh i didn't see the particles
is there a way to change the health of all blocks from a blueprint to 1?
Theres a function for setting health but im not sure if it actually works
ive heard people say its kinda weird
i feel stupid
in this case, shouldn't they both print 1?
but Tab[k] remains unvaried
eh, it works if v is a table, but not if v is a number
wth lua
oh, i got it, it's due to it being a reference and not the actual value
i forget that table be funky like that
no. You need to understand how variables are delcared/defined, and the copy semantics of types.
When a variable is declared, space for it is reserved in memory in the stack (which is extremely fast, it only requires an addition to a cpu register). Each variable is then associated with a different memory location. In the case of high level languages like lua/python, when you assign a variable to another, the data at the memory location of that variable is copied to the new variable
Values for types with fixed, known size are usually stored directly at the memory location of the variable, so when they are copied the value is copied and thus the original and new variables are independent. Values with unknown, dynamic size however can't be stored in this way due to how memory is managed, so instead what they do is store the actual data at a specific place dedicated for this sort of data with dynamic size (known as the heap, at the cost of being significantly more expensive to reserve data), and the memory location of the variable instead stores the memory address of where the data actually is (known as a pointer, usually along with some other metadata such as the reserved memory size and the used size). When you try to copy this data, you have 2 options: copy the data at the memory location of the variable (in the stack) and recursively copy any data at locations pointed to by any pointers found (in the heap), or just copy the data at the memory location of the variable (pointers/metadata to the actual data). The former is expensive to perform due to needing to reserve space on the heap (potentially many times) and often times not needed, so most languages choose the later, and you can implement the former yourself if you need it. This however results in the 2 variables using the same region of memory for data as they both point to it, so if it's modified through one of them, the changes will be seen through the other as well
Thus, when you assign to v, you are modifying just the region of memory of the variable, and the changes won't be seen on the original table. If v is a table and you modify it however, you will be modifying the data on the original table because you just copied the memory address rather than the values of that table, and are modifying the data at that original address
I do appreciate the in-depth explanation
But don't you have anything better to do at midnight?
If you say so, here, have fun not sleeping
||I am not serious, you do not need to do it, especially not right now (I ain't stopping you tho)||
the ironi
@near parcel deen answer real quick, so if i want a copy of a table, that i can modify without impacting the first one, what do i do?
if there is any way other than manually
you need to recursively copy the table
---@param t table Table to copy
---@return table # Copied table
local function copy_table(t)
local out = {}
for k, v in pairs(t) do
out[k] = type(v) == "table" and copy_table(v) or v
end
return out
end
for API types this just copies their reference, so if they aren't inmutable their changes will affect the object in the other table. Afaik there is no general function to clone userdata objects (which is what API types are for lua)
as i tought
there still do be something wrong with this and i don't know what
(it's unrelated to that, i think)
btw, this creates an infinite loop (until you run out of memory) if you have a table with circular references. It can be fixed, but it's better to just not do that
welp, i can't manage to make it work, now i should stop using this channel for tm unrelated stuff
U know how I asked for help a while back, that allowed me to upload the mod: 'bomb trajectory calculator' to the workshop
It's quite buggy at the moment, but it's somewhat useful for judging where your bombs will land...
Been working on a Python script to decompile / compile blueprints 😆 it’s a pain in the ass, but a fun side project
End goal is to make a nice little node editor for wiring complex logic
I’ll have to keep everyone updated on progress, but no promises of a release with my university schedule right now 🥲
oh thats cool
how do blueprints work anyway?
Compressed binary data stored in the color of the transparent pixels at the bottom of the image. Good luck decoding that and modifying it correctly for the game to not detect it as corrupt, specially when they have enough hidden data for it to reach the thumbnail of the blueprint
For sure
Honestly I like the png files 😅 seems like a cool idea to just send a photo of your creation, and your friend just drops it into their blueprint folder
I’m just working on generating blueprints, not actually modifying existing ones, so if I make enough progress, should be good
if it was json, we would still need an image to show it in the ui etc, so now it's only 1 file and not 2 to share etc.
I would assume, I have no idea about the reasoning behind it 😄
Either way, the blueprint layout is sick 👀
Also a small reminder you can spawn custom blueprints in mods now 
Not all social madia allow to share arbitrary files, but pretty much all allow to share images
Store every pixel of the image in the json
Honestly such a strong point of trailmakers blueprints
I'm sure that wouldn't be a disaster
You should accidentally leak the source code for the blueprint encoder
Same problem will apply, except it will likely be harder as you have to reverse engineer the whole process rather than just enough to modify a small thing
That’s the hell I’m going through
My next four month project
I’ll keep everyone updated on my success or failure 😆
Imagine having the source code at your fingertips
You don't want to store binary data in json. You are asking for disaster
I’ll let you clown on my encoder if I can slap a rough one together eventually 😅
Anyway, didn't someone already reverse engineer the blueprint code a long while ago
Pretty sure, but never found any good results for it
I know there was “crash blueprints” floating around, rumour was they were edited; pretty old stuff now though
Then clearly the message wasn’t passed on well 😆
I am speaking older
I have a feeling the devs are using protobuf for encoding their blueprints, but not 100% sure yet
I do see some obscure “assembly” references in the blueprint files though
Either protobuf or they’ve encoded an entire C# object, which I doubt
@near parcel this is your duty now
Afaik krono is the only one who did, but iirc his tool only took the data from a blueprint and inserted it in another image without modifying it, and those modified images stopped working as blueprints a long time ago
I’ve formally given you the role of decompiling it
Not interested
I’ve failed 😞
rip
🤔
I hope you get it done, that'd be very helpful for creating things with logic
ping in trailmakers
Not really, for basic circuits it's not necessary, and for more complex ones becomes a mess of connections impossible to understand
doing this for some internal benchmark tooling, can confirm it is truly disastrous
I hope you are at least encoding it in ascii (usually with a base64 library)
base64 yes, and the images are not too big
100% 😆 no clue why so many people are fans of following little invisible switch trails between blocks
Definitely think it has potential
because it allows to easily hide what's not important. You can organize the placement/rotation of gates to show the general flow of data through the system while abstracting the individual connections that aren't important, and only show those that are (when configuring the outputs of a specific gate)
It’s gets difficult at some point with complex circuits though
My brain really can’t wrap around tracing the invisible lines
for more complex ones becomes a mess of connections impossible to understand
That seems like more preference
i have working with systems with ~400-1400 logic gates. Trust me, if all connections are displayed you won't understand anything. Try looking at any complex circuit in scrap mechanic if you want to see how bad it can get. For complex circuits what you actually want to use is a hardware description language, which allows to describe a logic circuit like you would describe a software code (but good luck getting the average player to use that, it's overkill for a simple game)
Trailmakers logic are still better than scrap mechanic
In terms of connection method
I genuinely enjoy working with scrap mechanics logic 😅 and the idea isn’t for the average player, it’s for those of us crazy enough to mess around with complex logical
No way in hell am I going to be trying to edit blueprints
Just purely logic for obscure things
Anyways I’ll leave this discussion until I have a working demo to show, otherwise it’s all just “in theory” 😆
Honestly scrap mechanic becomes unbearable if you put your gates in a slab or cube, any compact format, they just all overlap making it complete chaos, with tm you only see the one from one gate (tho being able to see all gates connected to a specific gate is a nice missing feature)
Even if you were focused on a gate, and you saw connections going in as red lines, that could be neat
it's not really just "in theory" when other games have tried it though
Have tried a node editor..?
even if you use a 2D plane, it will still become a mess as the graph defined by the logic gates as vertices and connections between gates as edges isn't planar for any non-trivial circuit, so you will still end up with connection overlap
Alvaro, one thing you genuinely need to understand is preference
Just because you prefer one layout doesn’t mean it’s universal
yeah, i tried several when i first got into logic to design basic circuits, even at ~50 gates it starts to become a mess
Which tools did you use? I was thinking unreal-style nodes
devs fixing wheels + trigger colliders when? (the only issue is that wheels interact with them)
trigger colliders just dont as a whole
Spawned with **SpawnBoxTrigger **or is SetIsTrigger used after spawning?
The latter
setistrigger

When making a map, how can I make a blueprint respawn more reliably? Right now 95% of the time I can't respawn.
So I'm making a mod that uses the camera features but when following fast-moving structures it goes in front of the structure. What is the correct formula for calculating error needed for stabile follow.
the cameras need to have high update rate, and adding position to velocity of structure multiplied by deltatime for added smoothness could help, idk about anything else, I guess you could lerp the position and do something with the velocity again to make it even more smooth but I haven't spent much time with the cameras
It won’t work as the cameras teleport between positions
forgot it's not a physics object
me when no client side smh
thanks i will try the velocity correction
Actually, does the host also have a delay with the camera functions?
or is the network call instant
well it's not instant
Host still has separate server/client processes
I mean like
Does the host's server side communicate with the host's client side through steam?
Like it would with another player's client?
neither the host nor other players communicate with the server through steam. The steam API is just used to establish the initial connection, after which it is a direct connection. The host's client likely communicates with the server in the same way as any other clients (with a transport layer socket), but even if it used the OS's IPC it would still suffer from not running in sync with the server process and at different fps like all the other clients
ah alright
🤔 how could one detect collisions with blocks/structures
What if Trailmakers was called Modmakers and it was about making mods and not trails
Some english dude named garry did that pretty well
huh?
the blocks havent taken damage so why is the current health so much lower than the start health
wee
how could i make a really big explosion?
i thought about scaling up an explosion but im not sure if thats actually doing anything
or i dont know honestly, its really weird
if i put down two bombs far apart and one of them explodes, the other one does too most of the time(its not an issue with my code because making a smaller explosion doesnt trigger far away bombs)
but vehicles that are much closer to the bomb than the other bomb is dont receive any damage
Scaling the explosion only increases the physical explosion not the particles.
idk if thereis a limit im testing it now but no effect
i think this doesnt work anymore
then doesn't that just do nothing if one cannot heal the block to it's start health?
some explosions do very little damage, and since it only changes the damage distance it won't increase the damage, a way to get around this is spawning another scaled explosion with more damage (like PFB_Explosion_SeatDeath)
Pretty much
I just used it so that the start health isnt desynced from the actual block health
literally block.SetHealth(block.GetCurrentHealth()) lol
Has something like custom decals been suggested? Im guessing it has, but idk what the feedback was
No
iirc i suggested it on the older system
Oh hi jess, havent seen you in a while
Alr then, suggestion time
Could be nice as an integrated feature, redirecting you to your pc files. But if ot could work with mods, that'd be great too
how i saw it working was like: if you have the mod it adds said decals (by looking at the pictures, perhaps each requiring a certain id) and if someone without the mod loads said build they just don't show up
Are you saying that as a possible problem or solution
as a possible way for it to be implemented
Got it
Is it possible to write on the grey boxes that appear with mods and their options?
In game
Right, so you'd have to be directed to the file. I was thinking writing the file name on the box, and the mod would find it and create a decal
Then as the decal was created, it was assigned to the build, so that of someone without the mod downloads the build from the workshop i.e., they'd just have to activate it and the decal appears
Not sure if this is possible this way tho
Mods can't access files outside of their own folder
mods SUCK 😡😡
mods cause a decrease in pressure inside a pressurised volume creating a suction force
Is TrailCity broken for anyone else? @warm canopy
I am getting constant Failed to call update due to trying to SetScale on a nil object or something like that.
It probably used a now purged asset
Purged assets should return an empty object with a transform to mitigate that exact problem.
Then try logging every time it spawns an object, the problematic one will be right before the error
Yeah I am mainly just bringing it up as this haven't been reported to us by anyone (to my knowledge!) -- so I was just wondering if it was something on my end.
Yes.


