Continuation - Adding a custom hologram for the locomotive to set a variable in a mixin

259 Replies
FICSIT-Fred
FICSIT-Fredβ€’2mo ago
It has been attached to this message. -# Responding to Crash found in FactoryGame.log triggered by @The Urban Goose
The Urban Goose
The Urban GooseOPβ€’2mo ago
[2025.08.28-13.17.35:139][552]LogBuildGun: Warning: (2) BP_BuildGun_C_2147463161_BuildState::GetHologramCost failed cause no hologram spawned.
The Urban Goose
The Urban GooseOPβ€’2mo ago
In Root Game Instance:
No description
Rex
Rexβ€’2mo ago
Hmmm, so I think the hologram fails to spawn something Sadly the top of the callstack says "UnknownFunction" :(
The Urban Goose
The Urban GooseOPβ€’2mo ago
Classic You sure it's not the game not being able to spawn a hologram at all? It happens the moment I click the locomotive in the build menu. Gonna try it with the very last node (the "set" node) disconnected, let's see what happens (Just making sure the checks are not messing with it for some reason)
Rex
Rexβ€’2mo ago
Okay, that shouldn't change the hologram
The Urban Goose
The Urban GooseOPβ€’2mo ago
No crash So it's that node
The Urban Goose
The Urban GooseOPβ€’2mo ago
Gonna try it like this
No description
Rex
Rexβ€’2mo ago
Okay Does the crash happen with both vanilla and modded locomotives?
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yeah, happens on the vanilla loco too Since we're overriting the hologram in general Still happens
Rex
Rexβ€’2mo ago
Hmmm, can you show me the full editor window for the custom hologram?
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
(it's uncompiled cause I deleted a node for the currently unused variable)
Rex
Rexβ€’2mo ago
Okay, not sure if it matters but try copying the Arrow component from Holo_Locomotive Also try disconnecting the Exec pin from Configure Vehicle so that the thing does nothing
The Urban Goose
The Urban GooseOPβ€’2mo ago
Done both, trying it now Still an instant CTD when I select the locomotive (I've been trying it with only the vanilla one for now)
Rex
Rexβ€’2mo ago
Huh, this is weird
The Urban Goose
The Urban GooseOPβ€’2mo ago
Not doubting you, but could it potentially be the C++ code you wrote? Maybe something I broke to do with it?
Rex
Rexβ€’2mo ago
What does the C++ code look like right now?
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
Missing semicolon on line 18 in FGBUnitHologram?
Rex
Rexβ€’2mo ago
UFUNCTION, UCLASS, UPROPERTY and the like don't need a semicolon at the end
The Urban Goose
The Urban GooseOPβ€’2mo ago
Alright, fair
Rex
Rexβ€’2mo ago
IIRC, they're macros that expand to absolutely nothing when compiling C++, but that UHT (Unreal Header Tool) uses in order to generate things like reflection code to expose those things to the BP side
The Urban Goose
The Urban GooseOPβ€’2mo ago
Ah, I see, yeah, that makes sense OH
The Urban Goose
The Urban GooseOPβ€’2mo ago
I think it might be this?
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
Didn't set that up nvm, the default locomotive is set up like this as well
Rex
Rexβ€’2mo ago
I don't know, copy the values from the locomotive hologram
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yeah, I have, it is identical
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
No description
Rex
Rexβ€’2mo ago
Yeah I think the only change is the Arrow component
The Urban Goose
The Urban GooseOPβ€’2mo ago
Even that's in there now
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
No description
Rex
Rexβ€’2mo ago
I'm trying to replicate the error myself
The Urban Goose
The Urban GooseOPβ€’2mo ago
Here's a thought: The custom hologram has a definition for a recipe, but that only takes one. Could it be the fact that the recipe is set to my custom one, while I'm trying to build the train with the default recipe?
Rex
Rexβ€’2mo ago
That shouldn't matter I know it's crashing somewhere when spawning the hologram (BeginPlay is mentioned) But I'm not sure why that would be a problem
The Urban Goose
The Urban GooseOPβ€’2mo ago
And the CDO should apply to the BP_Locomotive class, not instances in the world, so it's not a case of the hologram reference being changed while the game is trying to access it?
The Urban Goose
The Urban GooseOPβ€’2mo ago
There's also this
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
What is a nullpeter?? I know of nullptr but not nullpeter
Rex
Rexβ€’2mo ago
That basically means "nullptr" I guess it's funnier to spell it like that
The Urban Goose
The Urban GooseOPβ€’2mo ago
fair? I assume that's not it either?
Rex
Rexβ€’2mo ago
But yes, it means the recipe class passed to FGRecipe::GetRecipeName was nullptr (so not valid) I'm trying to do this but I keep getting distracted
The Urban Goose
The Urban GooseOPβ€’2mo ago
All good lol
Rex
Rexβ€’2mo ago
Ah, right, the CDO that you edit needs to be saved to a variable in the game instance
The Urban Goose
The Urban GooseOPβ€’2mo ago
Ah
Rex
Rexβ€’2mo ago
The output of Get Class Default Object should go into a variable, then you would use the variable ExampleMod should be doing it this way too (although ExampleMod uses a sub instance module to keep things tidier)
The Urban Goose
The Urban GooseOPβ€’2mo ago
So this then?
No description
Rex
Rexβ€’2mo ago
Yeah, you can also use a Get VariabΓ±e node for the rightmost connection
The Urban Goose
The Urban GooseOPβ€’2mo ago
Gonna switch back to that in a moment, trying this out first Same for the == node? Ope, still crashes
Rex
Rexβ€’2mo ago
The one going to the equals node is fine It's just to avoid the long line, lol
The Urban Goose
The Urban GooseOPβ€’2mo ago
Oh you meant to the target on the set node Yeah, I peronally actually perfer this, makes it easier for me to tell what's happening
Rex
Rexβ€’2mo ago
Fair enough
The Urban Goose
The Urban GooseOPβ€’2mo ago
And yeah, the crash is still happening
Rex
Rexβ€’2mo ago
Am about to test myself Hmmm, for some reason it seems to work over here
The Urban Goose
The Urban GooseOPβ€’2mo ago
Then I'm doing something wrong I guess No bloody clue what though
Rex
Rexβ€’2mo ago
I'm only testing a hologram atm
The Urban Goose
The Urban GooseOPβ€’2mo ago
With or without custom C++?
Rex
Rexβ€’2mo ago
The C++ I wrote
The Urban Goose
The Urban GooseOPβ€’2mo ago
Actually I just thought of another thing: The vanilla locomotive hologram is based on FGRailroadVehicleHologram
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
IDK if ours is?
Rex
Rexβ€’2mo ago
Yeah, the BUnit hologram should be See header file
The Urban Goose
The Urban GooseOPβ€’2mo ago
Alright, just double checking everything I can think of
Rex
Rexβ€’2mo ago
At this point I'm tempted to have you DM me the build that's crashing you to see if there's more info in there
The Urban Goose
The Urban GooseOPβ€’2mo ago
As in just DM you the built mod from my mods folder?
Rex
Rexβ€’2mo ago
Yes, are you using Steam?
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yeah
Rex
Rexβ€’2mo ago
That works (if we were using different platforms, you'd need to package for release because C++ gets built separately for Steam and Epic)
The Urban Goose
The Urban GooseOPβ€’2mo ago
Ah sent
Rex
Rexβ€’2mo ago
Testing
Rex
Rexβ€’2mo ago
The Urban Goose
The Urban GooseOPβ€’2mo ago
It's in Tier 6, currently still as a separate milestone (I'd want it as part of the locomotive milestone, but one thing at a time)
Rex
Rexβ€’2mo ago
I tested the vanilla locomotive and got the crash
The Urban Goose
The Urban GooseOPβ€’2mo ago
Oh yeah, happens on that one as well
Rex
Rexβ€’2mo ago
Now we know that it's failing in SpawnLightWeightInstanceData For reference, I made my hologram class by copying Holo_Locomotive and then reparenting it
The Urban Goose
The Urban GooseOPβ€’2mo ago
Could try that Still crashing
Rex
Rexβ€’2mo ago
Hmmm, same 3 UnknownFunction things?
The Urban Goose
The Urban GooseOPβ€’2mo ago
Waiting on the error reporter
Rex
Rexβ€’2mo ago
So, to be clear, does it crash because of the hologram? Or because of the mixin?
The Urban Goose
The Urban GooseOPβ€’2mo ago
This disappeared
FICSIT-Fred
FICSIT-Fredβ€’2mo ago
It has been attached to this message. -# Responding to Crash found in FactoryGame.log triggered by @The Urban Goose
Rex
Rexβ€’2mo ago
I'd try disabling the mixin completely just in case (remove from instance module) Same line numbers so same lightweight crash
The Urban Goose
The Urban GooseOPβ€’2mo ago
Still crashing
Rex
Rexβ€’2mo ago
Huh, I'm stumped
The Urban Goose
The Urban GooseOPβ€’2mo ago
.-. I've been doing that a lot lately
Rex
Rexβ€’2mo ago
Do you do any other changes to the locomotive?
The Urban Goose
The Urban GooseOPβ€’2mo ago
Shouldn't be, no No other mods installed either, so no possible conflicts
Rex
Rexβ€’2mo ago
For reference, this is what I tested with
No description
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
Gonna do that then
Rex
Rexβ€’2mo ago
I get no crash, and I get logs from Configure Vehicle
The Urban Goose
The Urban GooseOPβ€’2mo ago
Still crashing... At this point I think I just broke something somewhere else Would it make sense to try to make a new project to test? Just blank project, add the C++ class, add the hologram, and test just that
Rex
Rexβ€’2mo ago
I would try to make a new mod tbh
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yeah, that's what I was meaning
Rex
Rexβ€’2mo ago
Ah I die a little bit inside when people go for the nuclear option of starting from scratch while I'm trying to at least figure out what went wrong
The Urban Goose
The Urban GooseOPβ€’2mo ago
I get that, but this is just so few files, and copying the assets into the folder works
Rex
Rexβ€’2mo ago
I meant the "let's delete the entire project and start from scratch" approach
The Urban Goose
The Urban GooseOPβ€’2mo ago
I just wanna make sure it's not something with the Linux editor or something like that Yeah, I meant just the mod folder, I kept everything else
Rex
Rexβ€’2mo ago
It's just that building takes a while for me, so I hate having to do that
The Urban Goose
The Urban GooseOPβ€’2mo ago
Eh, I can deal with it You said it works for you on a clean mod with just the hologram, so I'll try that. If that gets us further, I'll be back to where I was in no time at all So just so I have the steps clear: - Copy Holo_Locomotive and rename - Reparent the copied BP to custom C++ class - Add CDO for the hologram like in here
Rex
Rexβ€’2mo ago
Reparent the renamed Holo_Locomotive to custom C++ class The original should be left as-is
The Urban Goose
The Urban GooseOPβ€’2mo ago
That's what I meant I was just being dumb there Alright, got distracted but I'm now testing this Yep, still crashes, so it's something else...
Rex
Rexβ€’2mo ago
Did you remove your existing mod from the Mods folder?
The Urban Goose
The Urban GooseOPβ€’2mo ago
... I thought I did, I may have not
The Urban Goose
The Urban GooseOPβ€’2mo ago
Ok, empty mods folder, trying again
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
Still happening
Rex
Rexβ€’2mo ago
Ugh, but why?
The Urban Goose
The Urban GooseOPβ€’2mo ago
Same error too
FICSIT-Fred
FICSIT-Fredβ€’2mo ago
It has been attached to this message. -# Responding to Crash found in FactoryGame.log triggered by @The Urban Goose
The Urban Goose
The Urban GooseOPβ€’2mo ago
(For clarity: I copied the mod out of the folder, and made a new one under the same name)
Rex
Rexβ€’2mo ago
Hmm, can you send me that minimal test case you've made? I'll try to build it locally here and see if that might be it DMs work
The Urban Goose
The Urban GooseOPβ€’2mo ago
The mod folder from the SML project, yeah?
Rex
Rexβ€’2mo ago
Yes
The Urban Goose
The Urban GooseOPβ€’2mo ago
done
Rex
Rexβ€’2mo ago
Had to do some shuffling around to avoid name clashes with the C++ class
The Urban Goose
The Urban GooseOPβ€’2mo ago
We could also rename the C++ class
Rex
Rexβ€’2mo ago
I renamed it on my end So no problems there It's just that I had to do some shuffling around to avoid having a BP asset without its C++ class (then it can't be opened properly anymore)
The Urban Goose
The Urban GooseOPβ€’2mo ago
Ah
Rex
Rexβ€’2mo ago
Okay, so. Survey says... It's something about building on Linux. It works fine here.
The Urban Goose
The Urban GooseOPβ€’2mo ago
Hmm Yeah, was beginning to assume that
Rex
Rexβ€’2mo ago
Now that is cursed
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yes, yes it is Is it time for a Mircea ping?
Rex
Rexβ€’2mo ago
Most likely yes
The Urban Goose
The Urban GooseOPβ€’2mo ago
Are you gonna do it, or do I?
Rex
Rexβ€’2mo ago
The only other thing I can think of is that we're somehow not using the same headers, but that's weird
The Urban Goose
The Urban GooseOPβ€’2mo ago
I mean if we can check for that somehow, I'm good to check
Rex
Rexβ€’2mo ago
I can try comparing the DLLs you build against the ones I build One moment
The Urban Goose
The Urban GooseOPβ€’2mo ago
You'd need my built mod then one sec
Rex
Rexβ€’2mo ago
I have them in the Binaries folder
The Urban Goose
The Urban GooseOPβ€’2mo ago
Right, forgot about that I mean logically there should be a difference, right?
Rex
Rexβ€’2mo ago
@Mircea (Area Actions) It seems we have a case of a mod that crashes when built on Linux but works fine when built on Windows. Here is the source of a mod that can be used for testing
Rex
Rexβ€’2mo ago
That's what I'd like to compare
The Urban Goose
The Urban GooseOPβ€’2mo ago
Well, in that case I'll be AFK for a bit, I'll keep an eye on the chat
Rex
Rexβ€’2mo ago
Okay, I see one difference so far: the vftable for the working case has 302 elements, the vftable for the failing case has 301 elements
The Urban Goose
The Urban GooseOPβ€’2mo ago
Maybe I broke something in the main SML project when trying to recover from the C++ class I mistakenly added to FactoryGame that one time?
Rex
Rexβ€’2mo ago
I don't know, use git to your advantage You cloned the SML repo, right?
The Urban Goose
The Urban GooseOPβ€’2mo ago
I did
Rex
Rexβ€’2mo ago
git status my beloved My guess is that the call to SpawnLightWeightInstanceData (virtual) was actually meant to call something else
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
The one commit I have is placeholder assets in the locomotive folder (speicifically the particle effect, and the animation blueprint, the latter of which I didn't actually end up needing)
Rex
Rexβ€’2mo ago
Okay, looks like C++ is not affected
The Urban Goose
The Urban GooseOPβ€’2mo ago
Locomotive physics asset as well, but yeah, only three uasset files that my mods need to reference
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
Well, two, and one that I thought they did
Rex
Rexβ€’2mo ago
Can you look for ShouldUnlockHologramOnBuildStep in your project? Should be a virtual function in AFGHologram
The Urban Goose
The Urban GooseOPβ€’2mo ago
How, search in C++ classes? Or where?
Rex
Rexβ€’2mo ago
I don't know how Rider works, but it should be in FGHologram.h
The Urban Goose
The Urban GooseOPβ€’2mo ago
oh in Rider
Rex
Rexβ€’2mo ago
Files are stuff I got from Ghidra that show the difference
The Urban Goose
The Urban GooseOPβ€’2mo ago
Can't find ShouldUnlockHologramOnBuildStep in FGHologram.h
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
Github is doing the thing where the page won't load right, bear with
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
Rex
Rexβ€’2mo ago
I'm just showing the blame thing, the file is a bit long
Rex
Rexβ€’2mo ago
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yeah, but if you look, the header on the website hasn't loaded right Couldn't interact with anything
Rex
Rexβ€’2mo ago
No worries You should check the version you currently have And my guess is that you should update the modding project
The Urban Goose
The Urban GooseOPβ€’2mo ago
So just drop this in, and replace the one I have, then rebuild the project?
Rex
Rexβ€’2mo ago
No
The Urban Goose
The Urban GooseOPβ€’2mo ago
But I just cloned it a few days ago?
Rex
Rexβ€’2mo ago
Which branch did you clone? Can you run git log? OH, RIGHT You're using the linux-editor branch
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yeah
Rex
Rexβ€’2mo ago
That branch hasn't been updated to the latest SML version
The Urban Goose
The Urban GooseOPβ€’2mo ago
.-.
Rex
Rexβ€’2mo ago
Hold on, we're going to cherry-pick the header changes Which is just one commit So, stash / commit the changed files you have here, then run git cherry-pick 167d475fbdae796462d4842d2afe3ff27c06cea4 (which is https://github.com/satisfactorymodding/SatisfactoryModLoader/commit/167d475fbdae796462d4842d2afe3ff27c06cea4)
The Urban Goose
The Urban GooseOPβ€’2mo ago
(I am also still learning git, so bear with me here) Pretty sure they are committed, just not pushed, which should be fine, right? Yeah, that was a screenshot of a commit
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
Rex
Rexβ€’2mo ago
I meant that here you have changed DefaultGame.ini and Locomotive_Skeleton.uasset
No description
Rex
Rexβ€’2mo ago
If you could cherry-pick as-is, I guess it worked because the commit didn't touch any of the modified files
The Urban Goose
The Urban GooseOPβ€’2mo ago
I could cherry pick as is (Wouldn't have been an issue to lose those changes, don't remember changing the ini and the skeleton is changed cause I had opened it) They're still there though, so all good
Rex
Rexβ€’2mo ago
You wouldn't have lost the changes, git would have complained But yes, that's all cool You may want to do all the magic spells to build C++ again, then try and see if it crashes
The Urban Goose
The Urban GooseOPβ€’2mo ago
Doing that right now 70 actions, so it's definitely rebuilding stuff
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
Rex
Rexβ€’2mo ago
The files touched by the commit, although since it uses unity builds you don't see much going on
The Urban Goose
The Urban GooseOPβ€’2mo ago
Right, build done, starting up the editor now Editor open, building the mod Mod build needs 214 actions, so it's doing more Also yeah, I understood that, and I'm beginning to understand how the C++ workflow works Don't understand any of the C++ code itself, but at least I can build the project now I can at least read python and kinda follow that, C++ is just way too cryptic for me to understand most of it right now lol Mod built, let's see if this works NO CRASH!!!! πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰
Rex
Rexβ€’2mo ago
\o/
The Urban Goose
The Urban GooseOPβ€’2mo ago
Right, I assume the main mod will build now, gonna go ahead and test with that now
Rex
Rexβ€’2mo ago
The function I made for the hologram thing is rather simple. It's a virtual function, that overrides the base class' implementation (this concept also exists in Python). It begins by doing two things at once: - calls the base class' implementation (with Super::ConstructVehicle) and stores the result in a variable named Vehicle. - checks if Vehicle is not nullptr (nullptr evaluates to false, non-nullptr evaluates to true). If Vehicle is not nullptr, then it calls the ConfigureVehicle function that you see in Blueprint (passing Vehicle as parameter), and returns Vehicle . Otherwise (Vehicle is nullptr), it returns nullptr directly. The assignment inside the if-statement can be separate, but I prefer having it combined to avoid using something when it may be nullptr (bad things happen).
AFGVehicle* AFGBUnitHologram::ConstructVehicle(FNetConstructionID netConstructionID) const
{
AFGVehicle* Vehicle = Super::ConstructVehicle(netConstructionID)
if (Vehicle) {
ConfigureVehicle(Vehicle);
return Vehicle;
}
return nullptr;
}
AFGVehicle* AFGBUnitHologram::ConstructVehicle(FNetConstructionID netConstructionID) const
{
AFGVehicle* Vehicle = Super::ConstructVehicle(netConstructionID)
if (Vehicle) {
ConfigureVehicle(Vehicle);
return Vehicle;
}
return nullptr;
}
Python equivalent:
class AFGBUnitHologram(AFGRailroadVehicleHologram):
def ConstructVehicle(self, netConstructionID):
Vehicle = super().ConstructVehicle(netConstructionID)
if Vehicle is not None:
self.ConfigureVehicle(Vehicle)
return Vehicle
return None

def ConfigureVehicle(self, Vehicle):
pass # Implemented in blueprints
class AFGBUnitHologram(AFGRailroadVehicleHologram):
def ConstructVehicle(self, netConstructionID):
Vehicle = super().ConstructVehicle(netConstructionID)
if Vehicle is not None:
self.ConfigureVehicle(Vehicle)
return Vehicle
return None

def ConfigureVehicle(self, Vehicle):
pass # Implemented in blueprints
The Urban Goose
The Urban GooseOPβ€’2mo ago
Right, that's everything restored to how it was before we disassembled it for testing, it should work now
Rex
Rexβ€’2mo ago
@Mircea (Area Actions) Okay, it seems that the root cause was that the linux-editor branch wasn't using the latest headers. I've made a PR here: https://github.com/satisfactorymodding/SatisfactoryModLoader/pull/389
The Urban Goose
The Urban GooseOPβ€’2mo ago
hmmm, so no crash, but also no B-Unit
Rex
Rexβ€’2mo ago
Okay, let's revise all the Blueprints We have to reconnect stuff, and make sure the actor mixin is registered in the game instance module
The Urban Goose
The Urban GooseOPβ€’2mo ago
I have one thing I can test still Other than that I would've just gone in with print statements
Rex
Rexβ€’2mo ago
Got to do the dishes now, will check back afterwards
The Urban Goose
The Urban GooseOPβ€’2mo ago
Removed a check that happens for the hologram swap, just gonna swap it without checking for now to see if that's it Yeah, I still gotta go afk as well, cause I didn't actually end up doing that either
The Urban Goose
The Urban GooseOPβ€’2mo ago
Alright, tested it the Boolean doesn't correctly get set to true, it works if I set it in the editor, but obviously that'll apply to the default Loco as well. Means the error is here somewhere, specifically the last node which doesn't work right.
No description
No description
No description
Rex
Rexβ€’2mo ago
Print the value of mBuiltWithRecipe
The Urban Goose
The Urban GooseOPβ€’2mo ago
(To be clear: not having the branch there also doesn't work)
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
Rex
Rexβ€’2mo ago
Oh, so that doesn't work either
The Urban Goose
The Urban GooseOPβ€’2mo ago
no
Rex
Rexβ€’2mo ago
Have you tried logging the value of the boolean at various points inside the mixin? I think the boolean is not set in the mixin when BeginPlay gets called Actually Instead of using a boolean, make a function in the mixin and call it
The Urban Goose
The Urban GooseOPβ€’2mo ago
Right, just did it, trying that now
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
And then Make B-Unit has just the stuff from begin play
The Urban Goose
The Urban GooseOPβ€’2mo ago
We have a winner πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
The Urban Goose
The Urban GooseOPβ€’2mo ago
Doesn't persist through saves, but that can be solved, I really need to go now (and now that this is done my brain will let me) Oh hey cool, sampling works correctly
The Urban Goose
The Urban GooseOPβ€’2mo ago
Rex
Rexβ€’2mo ago
I think you can have a bool variable in the mixin, that is set to SaveGame, and that you use to call Make B-Unit in BeginPlay if it's set
The Urban Goose
The Urban GooseOPβ€’2mo ago
Gonna try that when I'm back home
Robb
Robbβ€’2mo ago
So the problem was the base game skeleton asset stub being modified? Speed read this thread while in the airport and that sounds like it was it? Or was it the Linux editor branch of SML being behind latest SML?
The Urban Goose
The Urban GooseOPβ€’2mo ago
The linux-editor branch of the SML project was out of date, some headers were outdated, so the C++ compilation didn't work correctly The skeleton had nothing to do with it, that's unrelated As far as I can tell the value isn't saving, I'm currently assuming I'm doing something wrong
Rex
Rexβ€’2mo ago
No, the problem was headers being out of date, see https://github.com/satisfactorymodding/SatisfactoryModLoader/pull/389
The Urban Goose
The Urban GooseOPβ€’2mo ago
Do I need to do anything other than creating the boolean, and ticking "SaveGame"?
Rex
Rexβ€’2mo ago
I would have thought that SaveGame would work
The Urban Goose
The Urban GooseOPβ€’2mo ago
AActually, I may not be setting the value right?
Rex
Rexβ€’2mo ago
I don't know, I can't see
The Urban Goose
The Urban GooseOPβ€’2mo ago
Lemme get it back to how it was before I disassembled for testing, then get you some screenshots
The Urban Goose
The Urban GooseOPβ€’2mo ago
Mixin Functions (Make B-Unit and Make NormalLoco have been tested and do work when correctly when building with the buildgun in game, and have been cropped for brevity) IsB-Unit is needed for EventTick to update particle effects and the engine glow.
No description
No description
No description
No description
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
And Configure vehicle in the hologram:
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
InitAsB-Unit has SaveGame ticked, IsB-Unit doesn't
No description
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
(Just went and removed the - from the variable names, just to see if that helps)
Rex
Rexβ€’2mo ago
Is the idea of IsBUnit to avoid double initialisation?
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yeah Well, IsBUnit exisisted first, but yes
Rex
Rexβ€’2mo ago
Hmmm, if the variable's value isn't saving, I'd say let's move the recipe check inside the mixin
The Urban Goose
The Urban GooseOPβ€’2mo ago
Gonna give this a go, cause it does sample correctly when saved, so the recipe gets saved
No description
Rex
Rexβ€’2mo ago
Yes, I realise that does make the custom hologram thing a bit pointless
The Urban Goose
The Urban GooseOPβ€’2mo ago
No, cause I still need it to build it
Rex
Rexβ€’2mo ago
Huh
The Urban Goose
The Urban GooseOPβ€’2mo ago
Wait no, I don't do I Do I?
Rex
Rexβ€’2mo ago
If moving everything into the mixin, the default Holo_Locomotive would work
The Urban Goose
The Urban GooseOPβ€’2mo ago
oh my god This does work It worked perfectly on load
Rex
Rexβ€’2mo ago
Does it sample properly too?
The Urban Goose
The Urban GooseOPβ€’2mo ago
yeah
Rex
Rexβ€’2mo ago
oooooooo
The Urban Goose
The Urban GooseOPβ€’2mo ago
It just works now This was the magic key And I think you're right, I think I don't need the hologram
Rex
Rexβ€’2mo ago
What does the custom hologram even do at this point? I think nothing meaningful
The Urban Goose
The Urban GooseOPβ€’2mo ago
Gonna disconnect the code
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
As far as I can tell this should still work identically to when this was all connected
Rex
Rexβ€’2mo ago
I agree
The Urban Goose
The Urban GooseOPβ€’2mo ago
Can I use the custom hologram to overwrite the way the hologram is drawn? Right now it still shows as a normal locomotive It does
Rex
Rexβ€’2mo ago
Probably yes, but I'm not sure how holograms decide what to draw
The Urban Goose
The Urban GooseOPβ€’2mo ago
Well technically this is ready for an alpha release Still needs some work, but mainly cosmetic Functionality is done Oh yeah, I set it back to the default hologram for now, still works Cause it was a CDO it touched the vanilla loco too, which I try to do as little as possible for compaiblity reasons (in case anyone ever makes a different loco model)
Rex
Rexβ€’2mo ago
You're still touching the vanilla locomotive, but if your "make normal loco" function does nothing, then it's as transparent as it can be
The Urban Goose
The Urban GooseOPβ€’2mo ago
The only thing it does is hide the three components the mixin creates Oh yeah, that's a thing, I tried removing those with destroy component, which didn't work I've resorted to just setting the visibility to off
The Urban Goose
The Urban GooseOPβ€’2mo ago
No description
No description
The Urban Goose
The Urban GooseOPβ€’2mo ago
Make B-Unit hides the spotlight, Make NormalLoco hides the mixin components
Rex
Rexβ€’2mo ago
I would try to spawn the components at runtime to avoid having extra components for the normal locos, but that's okay Oh, right, the B-unit has no spotlight because it's a middle section
The Urban Goose
The Urban GooseOPβ€’2mo ago
Considering I have to move it into position with the BP anyway, that might be the better option Not now though Ok, just tested what happens when you uninstall the mod: - B-Unit locomotives turn into Vanilla locomotives, but can no longer be sampled - Reinstalling the mod does NOT turn those locomotives back to B-Units, they have to be manually rebuilt, sampling remains broken Still means that as it is right now uninstalling wouldn't break any factory funtionality though
Rex
Rexβ€’2mo ago
Sampling is broken because mBuiltWithRecipe becomes null So it doesn't know what recipe to use to spawn the locomotive
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yeah, that makes sense, assumed as much That's what I expected though
Rex
Rexβ€’2mo ago
The only way to fix it for real that I know of would be to use a core redirect This mod has core redirects to replace belts/lifts with the vanilla counterparts: https://ficsit.app/mod/BeltMk6 You could have a note to do the same but to redirect the locomotive recipe instead You'd need one line per recipe you want to redirect
The Urban Goose
The Urban GooseOPβ€’2mo ago
Luckily it's only one recipe, so I only need one line Oh my god I just realised I completely forgot to thank you for all your help, I'm so sorry Thank you for all the help with this, I highly appreciate it!
Rex
Rexβ€’2mo ago
You're very welcome! I'm happy to help
Robb
Robbβ€’2mo ago
Core redirects for this case would only work when the mod is absent but the redirect is still present. How are you distributing the redirect? Presumably listing on your mod page?
The Urban Goose
The Urban GooseOPβ€’2mo ago
I have no idea, hadn't got that far yet, hadn't even looked into core redirects yet Quite frankly the fact that the locootives aren't just deleted is a win in my book. The only thing that breaks is sampling, other than that they function as expected (other than likely not returning materials when disassembled, cause no recipe, haven't actually checked that yet, I had no build cost on when testing)
Rex
Rexβ€’2mo ago
The idea would be that if anyone wants to fix sampling after uninstalling the mod, they can use this core redirect. Redirect would be distributed in the same way as Belt Mk7*
The Urban Goose
The Urban GooseOPβ€’2mo ago
Done I just remembered, that you sent this, cause I kinda blanked on it initially, and then forgot to go back. This was actually really helpful for me to understand the C++ code you wrote (and by extension any similar C++ code I may read in the future)
Rex
Rexβ€’2mo ago
I'm glad you found it useful!
Robb
Robbβ€’2mo ago
We should update the Open Source Examples page with info on the new features the mod is using. Can't do that now as I'm traveling
The Urban Goose
The Urban GooseOPβ€’2mo ago
I've been upgrading my old mods to Mixins where appropriate Previously train interiors was adding an actor using SCS hooks, which was running a runtime mesh replacement on the locomotive. Now I'm using a CDO and a mixin.
Robb
Robbβ€’2mo ago
The "train 2" system is interesting that it can revert back to vanilla train, but I think the skins system is probably how the game "wants" you to implement it. I wonder if it would be possible to make it compatible? Not sure it's worth the effort
The Urban Goose
The Urban GooseOPβ€’2mo ago
I'm not sure I understand what you mean
Rex
Rexβ€’2mo ago
Do you think the skins system would support reverting back to default?
Robb
Robbβ€’2mo ago
No, I don't think it would. I think that's the advantage of the current approach The game already has a skins system for swapping between functionally identical buildings that are different only in appearance (in a way that can't be handled just by customizer settings), like the ficsmas skins. They can be hot swapped with each other in place iirc. Your approach doea not currently use that system If you were to code it with that approach from the start, I don't think you could have the "on mod uninstall, it reverts to the vanilla locomotive" feature
The Urban Goose
The Urban GooseOPβ€’2mo ago
Yeah, I find that integral to the mod, I want this to be safe to uninstall. This way I don't break any factories by not updating my mod for half a year again .-.
Robb
Robbβ€’2mo ago
That's not very Modder's Curse of you /s
The Urban Goose
The Urban GooseOPβ€’2mo ago
Looks like I could also add an option to the mod, which allows you to convert all B-Units to normal locomotives when you load your save, to make uninstalling easier.
No description
Rex
Rexβ€’2mo ago
Sure

Did you find this page helpful?