#LethalLib
1 messages · Page 3 of 1
wait let me check the repo
afaik the reference in the network manager is the exact same as the original prefab
otherwise i would have had other issues in the past
wonder why it's behaving like it's deep for me
so far my experience aligns with what xilo is saying
if that's true that seems like really weird behaviour
i don't see the reason they would need to implement it that way
unless it is purely to protect the prefab
looking at this it just adds the original prefab to the list 
very
did you verify the component was missing from the spawned prefab?
yeah
hmm okay you seem to be right
@humble pasture I wonder if it just saves a list of components that were on the object or something
i am not sure what else could be happening
no w ait
nvm it did get added
lmao
okay yeah modifying after registering does seem to work fine for me @solar blaze
can i see your code?
i just did
testPrefab = LethalLib.Modules.NetworkPrefabs.CreateNetworkPrefab("test");
testPrefab.AddComponent<TestBehaviour>();

this is what I tried and what it currently is
actually kieth even if this was a thing it wouldn't have happened, because lethallib delays registry until networkmanager start
lol
speaking of, i don't need to do that
but why would that matter
it should not
if you look for your prefab in HideAndDontSave, is the component missing there too?
oh I have two, one with the component and one without. I guess there's just something I must have overlooked in my repo then sorry lol
ah, the one without might be the one from your bundle?
yeah I didn't think it would still be loaded if I removed it from there but I hardly recognize my repo anymore so I guess that's it
Ahh I see what you mean now. Unfortunately that doesn't seem to be fixing the issue, it still tries to use the base method :/
that's odd
you are referencing the latest version of lethallib right?
Yeah I'm referencing 0.13.2
that is very odd
hmm..
@fresh folio you did not have issues with this?
maybe i shouldn't have made the dictionaries nullable
just tested, them being nullable in the signature actually shouldnt've made a difference
what i said goes only for primitives
so yeah this is a really weird issue
i can't reproduce it either
so odd

the only thing i can think of is that it is somehow referencing an old lethallib version
shrug
yeah i have no clue
You dont need to use both though
my thought is that maybe they are referencing a dll file directly somewhere
and it is using that rather than nuget
(if they are even using nuget)
thats the only thing i can think of
I'm referencing straight out of my dev TS profile which has the latest version installed. But yeah it seems to not be using latest despite latest being what's referenced
Cause it's only saying there's 1 overload
Okay switched to nuget and it works 👍
nuget = poggers
I should switch to nuget at some point don't know how to start doing that only reference DLL in current script package
It's stupid easy
just copy that and paste into your csproj
Ah thanks
Is this just a certain thing I need to toggle in the NetworkObject script or will I need NetcodePatcher for this? The scrap item is basically locking people's inventories because only the host is allowed to drop it
Stack trace:
UnityEngine.Debug:LogException(Exception)
Unity.Netcode.NetworkObject:OnTransformParentChanged()
UnityEngine.Transform:SetParent(Transform, Transform, Boolean)
GameNetcodeStuff.PlayerControllerB:SetObjectAsNoLongerHeld(Boolean, Boolean, Vector3, GrabbableObject, Int32)
GameNetcodeStuff.PlayerControllerB:DiscardHeldObject(Boolean, NetworkObject, Vector3, Boolean)
GameNetcodeStuff.<waitToEndOfFrameToDiscard>d__355:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
GameNetcodeStuff.PlayerControllerB.SetObjectAsNoLongerHeld (System.Boolean droppedInElevator, System.Boolean droppedInShipRoom, UnityEngine.Vector3 targetFloorPosition, GrabbableObject dropObject, System.Int32 floorYRot) (at <af9b1eec498a45aebd42601d6ab85015>:IL_00D5)
GameNetcodeStuff.PlayerControllerB.DiscardHeldObject (System.Boolean placeObject, Unity.Netcode.NetworkObject parentObjectTo, UnityEngine.Vector3 placePosition, System.Boolean matchRotationOfParent) (at <af9b1eec498a45aebd42601d6ab85015>:IL_023C)
GameNetcodeStuff.PlayerControllerB+<waitToEndOfFrameToDiscard>d__355.MoveNext () (at <af9b1eec498a45aebd42601d6ab85015>:IL_0039)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e27997765c1848b09d8073e5d642717a>:IL_0026)```
Set the auto parent bool to false
Also set don't destroy with owner to true
Okay I had a feeling it was the auto parent thing being true, just didn't have time today for a test with it false. Thank you!
Does anybody know how to fix this exception?
idk much about this stuff yet, but just off the order of events in your logs it looks like you may be despawning a network object prior to letting a related RPC event to happen. (i'm guessing) you'd want to reorder it so the RPC fires before the despawn
(again im new to unity and rpc stuff, could be something totally different)
yeah that is a good guess
alternatively they instantiated the prefab but didn't spawn it
This is the method that is causing the exception when I hit the enemy
public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false)
{
base.HitEnemy(force, playerWhoHit, playHitSFX);
if (!isEnemyDead)
{
creatureSFX.PlayOneShot(hitDemogorgonSFX, 1f);
WalkieTalkie.TransmitOneShotAudio(creatureSFX, hitDemogorgonSFX);
enemyHP -= force;
if (IsOwner)
{
if (enemyHP <= 0)
{
KillEnemyOnOwnerClient();
return;
}
}
}
}
If you did register the network prefab and spawn it and this is occuring and only on death it looks like maybe move the TransmitOneShotAudio to only fire if the enemy isn't killed that hit.
Seems like what's happening in KillEnemyOnOwnerClient is more important than what's happening here too. But yeah my best guess is you're creating a race condition that despawn will win. You could even call killenemyonowner in an ienumerator after 0.5 seconds and see if it persists to troubleshoot. I assume you'll want to keep the enemy model in a disabled state and a death animation like the base game so you could probably even disregard this if you plan on not despawning it.
So I should just remove KillEnemyOnOwnerClient if I want to keep the body?
I'm at my pc now and took a proper look. Make destroyOnDeath in your enemy type false and you should be good
Oh okay thank you
the network prefabs all sit under a disabled object in the hide and don't save scene, my network prefab only starts working if I activate said object
is this the intended behaviour?
you're supposed to spawn it to activate it
thanks
hi, is there any documentation or like examples of using UnlockableItems? I just wanna add a couple of things to my mod and I can't figure out how to load the asset from a bundle and register it for the shop
I think Evaisa has unlockables in lethal things you could check as reference but I can send a couple screenshots of my stuff in unity and vs in a minute too.
I'm in no rush, if you want to send those that would be nice
I spawn it when the game loads so it has a behaviour like the cabinet or something so I didn't set a price or store type but do this with a price and store type and you should be good. This is how I have mine setup. Might have a thing or two wrong in there but should at least get you most of the way there
ohhh, that's convenient, thank you so much!
well, I'm not sure what I'm doing wrong but I keep getting this error: "[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object" I feel like I've tried everything to fix it but I guess I'm just not seeing the problem
Is it possible to set up a paid moons with LevelTypes?
do you mean like custom moons? You'd use #1193461151636398080 for that i think
I'm registering a custom enemy, and I want it to only spawn on paid moons
ah
yeah you'd have to manually assign the levels
not something i had considered before
sorry to bother you, but could you tell me the average rarity of the enemy? It's currently at 10, but I'm not sure if that's low enough
this is a bit outdated but maybe helpful
https://docs.google.com/spreadsheets/d/1k7me3XlweXByhgCFS7GzsHOEPaJEzHD94dtI63NdBfI/edit?usp=sharing
Sheet1
Experimentation,Assurance,Vow,March,Rend,Dine,Offense,Titan
Centipede,51,93,61,38,31,52,27,54
SandSpider,58,69,40,64,43,64,44,59
HoarderBug,28,78,63,36,X,48,16,38
Flowerman,13,14,80,56,51,25,3,62
Crawler,16,24,9,74,X,48,55,54
Blob,31,28,28,15,6,39,32,20
DressGirl,1,1,X,X,20,18,X,28
Puffer,28
oh there was this thx 👍
How does LethalLib add enemies to levels? Enum or SelectableLevel ref
SelectableLevel
but it uses the enum name to find the correct one
enum name matches the level asset name
I can prob do a very small function in LLL to pass it over to you
Level asset name?? Omg it was YOU
? lol
you are the person who have people thinking internal level names are [Name]Level 😛
LMAO
💀
And LLL’s name check is too lenient so it’s like confirmation biasing people 😭
var name = level.name;
var levelEnum = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name)
yeah lol
this is how lethallib has done it since the start since it was an easy way to turn the asset names into flags
That’s fairrrr
Tbh you gotta give it to zeekerss for being consistent here ;)
the only reason i chose the asset names is because of that
I assume these enemy spawns use a ticket system like the moons do?
it is just a weighted list system
the way ive had the moon dungeon chances explained to me that makes the most sense is picturing a lottery where one dungeon has 300 tickets and the other has 15, and then a ticket is picked at random
seems to be what a weighted list is
yep thats pretty accurate
whats the difference between X and 0 here? is it just cuz those enemies aren't included in the array at all?
i think these are right
is "DiceItem" the correct path here?
pretty sure you'll need the file suffix as well
so in this case DiceItem.asset
I think you can load assets like that without using the absolute path though yeah
but if you ever wanna see the paths you can open the .manifest file that is generated alongside your assetbundle and it will list the absolute paths of all assets it contains
my question is kinda getting drowned in dev-gen, but I'm trying to figure out an error if someone can help out https://discord.com/channels/1168655651455639582/1199501463387390022
it's regarding LethalLib btw that's why I figured I'd ask here ^
wonder if it's because you have a space in your path
I mean it didn't cause issues with any of the other assets, but maybe
NetworkPrefabs.RegisterNetworkPrefab(WallFlags.unlockables[0].prefabObject); I at least found out this is where the error is, I just don't know why
Well you said WallFlags is null
yeah, if it's null the only point it could be null or not null is here
unless you're doing something crazy in between
no
idk
I checked if it's null as soon as I create it
and it is
so
wait
now it's not? I just checked it again and it didn't make it through the if statement this time
idk what happened, but I'm still getting the error
can you send the snippet of your code quick
UnlockablesList WallFlags = bundle.LoadAsset<UnlockablesList>("Assets/Pride Flags/PrideWallFlag.asset");
if (WallFlags == null)
{
Logger.LogInfo("Wall Flags is null");
}
if (WallFlags.unlockables[0] == null)
{
Logger.LogInfo("WallFlags [0] is null");
}
TerminalNode val = null;
val = bundle.LoadAsset<TerminalNode>("Assets/Pride Flags/WallFlagNode.asset");
NetworkPrefabs.RegisterNetworkPrefab(WallFlags.unlockables[0].prefabObject);
Utilities.FixMixerGroups(WallFlags.unlockables[0].prefabObject);
Unlockables.RegisterUnlockable(WallFlags.unlockables[0], StoreType.Decor, null, null, val, 0);```
if it's in that order
wall flags is null
but if I switch the if statements I get the error thrown first
which I guess makes sense if it's trying to pull nothing for an if statement
So neither of those are logging or just wallflags [0] is?
the first one is logging
oh I see what you mean
wallflags [0] throws an error, yeah
ok so I mean it can really only be that your asset bundle just doesn't contain the asset at that path right? You're sure you didn't forget to replace the old asset bundle with the new one when you regenerated it with this new asset?
I reopened the manifest and copy+pasted again, but no differences
I can't register an object
yeah but did you drag the freshly generated asset bundle into your plugins folder though?
like we're positive you're not just using an old asset bundle
oh hahaha
that's an UnlockableItemDef not an UnlockablesList
That'll still work but you just have to make sure you're loading that type
should I just use a list? I've tried the other types and they give me more issues
I just couldn't find the list in unity to make and I thought it was just under a different name since I didn't see Unlockable Item Def in VS
a list might be easier anyway
and I found it in unity
I knew it was something simple I was missing
yeah
i mean UnlockableItemDef is custom
Yeah that's what I thought
well thank you, I'm sure I'll run into another issue before I finish this update lol
i have little to no unity experience but i will brute force making a scrap item. speaking of are there any tutorials on making a scrap item with lethallib
LethalLib Source - https://github.com/EvaisaDev/LethalLib
LethalLib Download - https://thunderstore.io/c/lethal-company/p/Evaisa/LethalLib/
Unity Template - https://github.com/EvaisaDev/LethalCompanyUnityTemplate
Asset Bundle Browser - https://github.com/Unity-Technologies/AssetBundles-Browser.git
My GitHub with lots of example LC code - htt...
thanke
ok, new issue, anyone know why it's just not appearing in the terminal?
getting some errors when trying to make an enemy with LethalLib, appears in-game but breaks the terminal, making it impossible to leave it
discord formatted that weird but theres 3 photos there
any resources on making a custom enemy?
hopefully that'll be changed soon enough
Tbf there will be a better way to write ai soon enough so
Do I need to AddNetworkPrefab when using RegisterEnemy?
oh i found RegisterNetworkPrefab
- is worked as well
when implementing customweather, what exactly is it expecting as WeatherEffect?
@fresh folio @timid brook Please stop shitting on other people's work. Especially you, Noop. You have been the only person on this server who has been disrespectful towards me, and you've only been disrespectful. And for what, that I, a person who is new to modding, dare to work on making modding resources for things that don't have any?
Apologies, my comment was purely toilet humor (aha) and probably heavily misinterpreted as toxic. I haven't the slightest clue how to make an enemy, I'm very new myself. I look up to the people like you making cooler stuff than I could
haha, that's fine! It's hard to recognize jokes through text, especially in the context of Noop's comment 😄
I suppose I’m less frustrated with the fact that you made documentation and more the fact that we’re teaching people using how the base game does it cause the way the base game does ai is very bad
The modeling side is helpful though I think the donut tutorial actually sucks for anyone wanting to learn blender and id suggest an alternative is used
Idk what the python script is for when evasia has the premade unity project already but if it works it works I suppose
It’s also quite simple but to be fair making resources on making a more complex ai is hard because once you stray from chase in a straight line and hit enemy it becomes very case by case
Overall sorry for coming off as rude towards you, I’ll try to tone it back and also lmk if you want any other input (I’ll try to word it better than I have lol)
the unity project doesn't come with the plugins, or an automated way to copy them over, right? So it does that + generates you a csproj.user file to automatically copy over your mod files to your testing plugins path. So it's a few things done with one script, which is a nicer experience than having to do that yourself. I should probably also make it use the csproj.user file for the game file references, but for now it doesn't do that.
the idea is you make the plug-in separately usually
And move it into unity after you build it
I guess you will get into more complex AI by learning how to do basic behaviors
But workflows vary
I could do that, but it then requires opening Unity to even build the project, but yeah idk, both approaches have their upsides and downsides.
What do you mean open unity to build the project guh
You have a csproj in a solution somewhere on your pc and then you build it cause mod done and then you add it to your unity project so you can add the component to the bundled asset
I think it’s just a differing workflow that you use
Cause most people just work in vs/rider first
okay I'm not completely getting what you are saying. The setup script is mostly to get all the files there that I can't distribute so you can build the asset bundle and the mod itself.
Evasia’s project template comes with stubbed versions of the game scripts
If that’s what you’re basically doing
but it also requires you to add DLLs into the Plugins folder in Unity so you can build the asset bundles
Oh ok you’re just moving the assemblies over lol
yeah
If you didn't get anywhere WeatherEffect should just be a scriptable object you can create in a unity project and bundle or do ScriptableObject.CreateInstance
oh okay. so i can make that the custom weather object
My fork of lethal lib seems to be having issues regarding Registering Network prefabs. I have already confirmed that the mod I am testing this with works with the thunderstore version of lethallib
Not sure if I'm supposed to clone the main branch or the dev branch either
hey, i have my item set up and working for the most part. im struggling with adding functionality to it. Currently its set up to damage the player when leftclicking . i need it to add/remove particle system, lights and maybe change the material of the asset. What would be the best way to go about it?
light could be added as another part of the prefab and turned on and off through code
changing the material properties could also be done through code
with particles I have no experience
is there an example of changing an asset through code. i have no idea how i would acces/ change it once i have build it
main branch should be thunderstore version because the code is compiled and uploaded with a github action
unless i never pushed it
oh i accidentally pushed changes to main branch instead of dev branch at some point i guess lol
I am curious why this error happened for you, because lethalthings works fine with either version of the network prefab registry.
In the main branch this is how network prefabs are registered
and NetworkManager is null when you try to register a prefab on your plugins awake method
the dev branch had the working version, so idk
it looks like theres some discrepancy between the main branch and the dll thunderstore is building(?)
i just never made it build this version, but this is what i have been testing lethalthings on
lemme check something
oh huh, okay i guess i never actually built this version locally
lmao
anyone know what's causing wall decor to be placed so far off the wall?
I thought it might have been default but then I say lethal things had some nice wall decor and I was wondering if there was a solution
Is anyone familiar with how to add unlockables to the terminal menu? I'm really struggling here 😅 been at this for a few hours now
I will be more than willing to help, what issues are you running into?
My goal is to have a ship upgrade for the teleporters that I can reference later to add functionality to them. I'm trying to make it so I can buy this upgrade from the store. It keeps juggling between not recognizing my keywords, saying there's none in stock, and saying I've already own it when I definitely don't
So I guess what I'm asking is what specifically do I need to give to the Unlockables.RegisterUnlockable function, and which parts do I not need to specify?
Unlockables.RegisterUnlockable(unlockable, StoreType.Type, TerminalNode1, TerminalNode2, TerminalNode3, Price);
This is what I've been fiddling with for a while now - is there anything I'm doing wrong?
I can't tell if I need the TerminalNode object at all, since LL's code appears to make one for me I believe. I also have a weak grasp on what exactly TerminalNodes are, so that may be adding to my confusion
So with this code here, it's telling me it's not in stock when I try to buy the upgrade. Where does it store what's in stock and what isn't? Should I be setting some value for my upgrade somewhere to stock 1 upgrade?
one of the buy nodes needs to be your terminal node
unless you're setting that in unity
wait I see nvm
well, I have not messed with upgrades, you do have to set it's type
It looks like the LL onAwake function overrides pretty much all the data from those terminal node object I pass in anyway, so not sure about what I can do differently
Which type?
I did it in unity, but buy unlockable id is in the terminal node and the unlockable item itself has to be set to 1 if it's not a suit
I’ll give it a try, thanks
Hey there, i'm currently trying to add an item that is buyable through the terminal and delivered via the dropship (using LethalLib), all works fine for the most part, but it looks like the weight property of the item is not being reflected in-game for some reason, it should be 8 and somehow went up to 945lbs.
Has anyone ever ran into such an issue and fixed it ?
I might also just be missing a component or something, idk.
Feel free to @ me and ask for additional information about my item's setup.
Weight calculation is a little wonky in this game.
Use
(itemWeight - 1) * 105 to get the weight you want
itemweight being the float you put in the inspector
You can also do
(desiredWeight/105)+1
to get the itemWeight
so for your case 8 lbs would be 1.07619048
well, i did just that but it seems to still be stuck at 945lbs
(and i verified that both my DLL and my assetbundle are up to date)
edit: the weight value like you said does work for a regular scrap item i find in the factory, but it does not seem to be working properly on the one that comes from the dropship 
(i set both to the same value)
oh wait it works now
well no idea what i did but eeeh, thank you a lot @hollow sorrel i'll keep that formula somewhere x)
Hey guys, I'm using the Custom Enemy API to create a new enemy, and encountering a weird issue. When running with a single player, the enemy works fine. Last night I was using the mod with some friends with me hosting. I saw that the enemy had spawned, but nobody else in the game could see it. Any ideas as to why this might happen?
did you register the enemy as a network prefab or something?
I'm not sure exactly what you mean. I used LethalLib.Enemies.RegisterEnemy()
you did not register it as a network prefab
register the enemy's spawn prefab with RegisterNetworkPrefab()
that way the transforms are networked
thank you! this worked!
now I'm having a separate issue. the enemy can kill the host's player, but then not any other player, even after calling player.KillPlayer()
can you show your code for OnCollideWithPlayer()? Or whatever you are trying to do
Did some debugging and isolated the issue, here's the Rpc I'm using to kill players:
`[ServerRpc(RequireOwnership = false)]
public void KillPlayerServerRpc(int playerId)
{
Debug.Log("Ping!");
KillPlayerClientRpc(playerId);
}
[ClientRpc]
public void KillPlayerClientRpc(int playerId)
{
PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerId];
player.KillPlayer(Vector3.zero, spawnBody: true, CauseOfDeath.Unknown);
Debug.Log("Pong!");
refreshTarget();
}`
The host's log prints both Ping! and Pong!, the client prints neither
well, that's fun
yeah it's really weird
the Snail is moving around just fine on the client side, it even chose the client player as its target and paths towards it
it just won't kill the client player
Is that your code or Zeekerss' code btw?
that's my code
I know I must be doing something wrong, the Rpc isn't working at all, it's just executing entirely locally
you could trust the client to kill themselves by just having something like this
public override void OnCollideWithPlayer(Collider other)
{
if (timeSinceHittingLocalPlayer < 1f) {
return;
}
PlayerControllerB playerControllerB = MeetsStandardPlayerCollisionConditions(other);
if (playerControllerB != null)
{
LogIfDebugBuild("Example Enemy Collision with local Player!");
timeSinceHittingLocalPlayer = 0f;
playerControllerB.DamagePlayer(20);
}
}
how do I post pretty code like this? right now I'm just using `
public override void OnCollideWithPlayer(Collider other)
{
if (!other.gameObject.GetComponent<PlayerControllerB>())
return;
base.OnCollideWithPlayer(other);
if (stunNormalizedTimer >= 0f)
return;
PlayerControllerB player = other.gameObject.GetComponent<PlayerControllerB>();
if (player != null)
{
if (!player.playerUsername.Equals(targetPlayer.playerUsername))
return;
KillPlayerServerRpc((int) player.playerClientId);
Debug.Log("ImmortalSnail killed player " + player.playerUsername + "!");
}
else
Debug.Log("Collided with a player but it was null.");
}
```cs
thanks!
here's my current code for OnCollide
the bottom cs isn't necessary, I accidentally copied it
ok nw haha
anyway, any ideas as to what's wrong based on this code? I'd like to get the rpc working if possible
yeah I think using Rpcs here is unnecessary
really?
I just figured I should since all of the EnemyAI classes in the base game use them
I'll try without and let you know what happens
I have had an issue with a ClientRpc not working when called from HitEnemy() but it worked from elsewhere in my code. Really strange issue, so yeah idk.
are there any potential downsides to not using Rpcs here?
I think the base game isn't a particularly great example of Rpc usage, though I'm no expert by any means. I need to check if I should use an Rpc here though
the DamagePlayer() method will call an Rpc to make sure everything networks
so yeah, you don't necessarily need Rpcs when methods you call also do that
KillPlayer() also calls Rpc methods (such as KillPlayerServerRpc(), so you shouldn't need to do that yourself
ok I took out the Rpcs and now I’m just using KillPlayer() directly in my code for OnCollide(). same behavior 😦
so OnCollide() isn’t being called on client side
You should probably be using OnCollideWithPlayer(), seems to work for me and that is what enemies in the game use
Also, make sure you have a (trigger) collider with Enemy AI Collision Detect (Script) as a component in Unity
sorry if I misspoke earlier, I’ve been using OnCollideWithPlayer() since the beginning
also I do have a collision detection script attached
the only thing i’m doing that’s a little weird is attaching my AI in my plugin, not in the prefab editor in Unity
I use ‘prefab.AddComponent(typeof(SnailAI))’
maybe i’ll put up a repo so you guys can just see all of it
any ideas off the top of your head? sorry ik this is a lot of info. again, the main problem is that OnCollisionWithPlayer() is being called on the server and not the client
You should probably see how Toilet Leech does things, it probably can answer your question #1187553119568134265 message
ok thank you!
no problem!
Anyways, I think this might be your problem. This is where I add my enemy (lines 27-28) https://github.com/Hamunii/ToiletLeechIsReal/blob/0b646e965dcc92a93f1c8271dd7448d1a24f55fc/Plugin/src/Plugin.cs#L27 (in case you didn't figure it out yet)
Why?
nvm I'm stupid, I misunderstood what that line is doing. So, you're adding your AI script afterwards?
Anyways, my guide does explain how you can add it to your prefab in Unity
what happened with the update to obliterate everything
did the new LethalLib update break something?
it has made #1191847266777042985 consistently have massive desync, and some people in #1186884307332108339 have reported other issues
Okay, just confirmed it with Toilet Leech: shit is busted. Toilet Leech did not spawn for the other client, and instead the console shat out errors:
[Error : Unity Log] [Netcode] Failed to create object locally. [globalObjectIdHash=1992188955]. NetworkPrefab could not be found. Is the prefab registered with NetworkManager?
[Error : Unity Log] [Netcode] Failed to spawn NetworkObject for Hash 1992188955.
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
Unity.Netcode.NetworkMetrics.GetObjectIdentifier (Unity.Netcode.NetworkObject networkObject) (at <895801699cfc4b4ab52267f31e2a4998>:IL_0000)
...
@lofty nymph you might want to revert the latest update to LethalLib
Looks like the pull request here broke networking stuff
https://github.com/EvaisaDev/LethalLib/pull/53
Might wanna revert @lofty nymph when you're online
I hope I'm not too stupid when asking this since I'm new to the whole modding scene,
But it seems that I can't seem to get my scrap item to work as a shovel, sounds work and generation does too. but there are no animations on the shovel whatsoever
I'm the one who made this pr! can anyone do a quick check to see what the differences are between the previous network prefabs.cs and the one with the broken one
just as a quick check since in my pc they're the same. No idea how my PR would break anything network related unless if its related to the network prefab registration change
id be glad to know the reason
theres no way the function signature somehow changed right 
Ah I found the issue now
https://github.com/EvaisaDev/LethalLib/pull/57 new PR for fixing the issue. A complete oversight on my side of the PR. NetworkPrefabs.Init() got removed in Plugin.cs when Eba might've accidentally pushed changes to the main branch instead of the dev one when she made changes to NetworkPrefabs.cs.
my old pr reverted the change but i didn't look at plugin.cs to check if Init was called for networkprefabs
Okay i merged it
Any chance this log could get reduced abit?
[Info : LethalLib] Added lightbulb_item to ExperimentationLevel
[Info : LethalLib] Added lightbulb_item to AssuranceLevel
[Info : LethalLib] Added lightbulb_item to VowLevel
[Info : LethalLib] Added lightbulb_item to CompanyBuildingLevel
[Info : LethalLib] Added lightbulb_item to MarchLevel
[Info : LethalLib] Added lightbulb_item to RendLevel
[Info : LethalLib] Added lightbulb_item to DineLevel
[Info : LethalLib] Added lightbulb_item to OffenseLevel
[Info : LethalLib] Added lightbulb_item to TitanLevel
[Info : LethalLib] Added lightbulb_item to 13 Kast
[Info : LethalLib] Added lightbulb_item to 74 Acidir
[Info : LethalLib] Added lightbulb_item to 154 Etern
[Info : LethalLib] Added lightbulb_item to 46 Infernis
[Info : LethalLib] Added lightbulb_item to 112 Aquatis
[Info : LethalLib] Added lightbulb_item to 43 Orion
eg.
[Info : LethalLib] Added lightbulb_item to ExperimentationLevel, AssuranceLevel, VowLevel, CompanyBuildingLevel
etc.
and
Info : LethalLib] Adding Shotgun to terminal
[Info : LethalLib] Generating buynode2
[Info : LethalLib] Item price: 600, Item index: 21
[Info : LethalLib] Generating buynode1
[Info : LethalLib] Item price: 600, Item index: 21
[Info : LethalLib] Generated keyword: shotgun
[Info : LethalLib] Adding Shells to terminal
[Info : LethalLib] Generating buynode2
[Info : LethalLib] Item price: 20, Item index: 22
[Info : LethalLib] Generating buynode1
[Info : LethalLib] Item price: 20, Item index: 22
to
[Info : LethalLib] Adding Shotgun to terminal (Item Price: 600, Item Index: 21)
[Info : LethalLib] Adding Shells to terminal (Item Price: 20, Item Index: 22)
sure thing, there is probably more(?
i have a lot of debug logs
yeeeee dont worry im fare from innocent myself
well i like these because they can tell me at a glance if things are working
when looking at someones log
Oh absolutely, Just would be slightly more ideal if the lines were condensed
the reason it logs every item individually is actually because when there is a stack trace it tells me what item it broke on
was reading this log someone had in another mod thread and lethallib was a little chunky, might just be easier to send here incase you want ref.
but yeah i agree that doesn't come up that often
some of my functions have a debugbool to easily turn on/off per item logging
could just add extended logging as a config option
yee
you could also make them LogDebug, that way for most people it won't show up as it's off by default in bepinex config
and whoever needs them can still enable them
I owe you ❤️❤️
i did not end up merging the logs because that ended up requiring more changes
Hey guys, I'm sure you're tired of hearing about my syncing issues but I've isolated the problem and now I'm not sure how to go about fixing it. Here's some notes I took on the issue:
on spawn snail on host player:
- client and host called Start
- client and host called refreshTarget
- host called OnCollide
3a. host called KillPlayer (host) - host called refreshTarget
4a. set client player as target
on collide with client:
- client and host call OnCollide
1a. host calls KillPlayer (client)
doesn't work because host doesn't own client player
1b. client does NOT call KillPlayer because target is still set as host player
so essentially the issue is that initially only the host calls OnCollide which prevents the client from updating the targetPlayer
could it just be a latency issue? the host dies immediately after spawning the snail so OnCollide is called, the client doesn't call OnCollide because the snail doesn't exist yet?
or maybe I need to insert an RPC that updates the targetPlayer across clients?
can confirm it is not this
I actually don't know if targetPlayer affects who the enemy can collide with, but yeah the refreshTarget() method should probably be a ClientRpc so everyone gets it I guess. Perhaps it would be best for the enemy on the host decide its target player, and then transfer that infromation via a ClientRpc or some other way. All I really know is Rpc methods.
I had the same thought. are RPCs fairly easy to implement? the base game RPC code is pretty confusing to me and I haven’t seen an explanation for it anywhere
also, the targetPlayer issue is some custom function of my AI. it can only kill a player that is the target player.
most of the base code rpc is autogenerated, which netcode patcher will do for you
here's an example of the autogenerated code
https://lethal.wiki/dev/advanced/networking#why-netcode-patcher
amazing thank you so much!
followed this guide and now it works! Unity Netcode Patcher is a godsend thank you Evaisa!!
Is there a guide for creating enemies? When I tested it, I did it in local multiplayer, and it spawns in the vents normally on all clients, but online it seems to only spawn on the host.
ugg the dreaded "works in LAN but not online"
are you using the latest version of lethal lib? ik there was an earlier version that broke network stuff
yes people who reported the bug said they were playing with 0.14.2
@frank lotus 
(there's an obsolete attribute)
also @lofty nymph is lethal lib network registration (specifically weather & enemies) independent of mod load order? cause when I'm looking through the source, it doesn't seem so
and iirc that does matter between clients
though don't quote me on that
actually does it 🤔
no it doesn't
not really
considering globalobjectidhash is the set on the actual prefab
which is what is used for making sure 2 prefabs are the same
wondering what would cause a monster to spawn on host but not clients (when online)
you have to register the network prefab before registering the enemy right?
does not matter
as long as it is registered before being spawned
yep
do the users have the same version of the mod?
yes they used the thunderstore modpack
though if you don't remake the prefab, the prefab id should be the same 🤔
Network transform correctly set?
is there any documentation for how the rarity actually affects spawn rate when using Enemies.RegisterEnemy()? I'm guessing it's more complicated than rarity = 100 => 100% chance of spawning
I think it's the probability weight of the enemy from the levels enemy pool
got it. any idea where I can see other weights?
ingame, or make a patch to print the pools of all levels and write it to a file
you could also probably calculate it dynamically, like sum up each levels pool weights then calculate the weight you need to add to get to a certain percentage
but then it's mod load order dependent
In a rip of the game
It seems to be because of the item name
My netcode patched enemy seems to be failing to send rpcs and idk why
nvm, it looks like you searched your dictionary for a key that doesn't exist
change it to TryGetValue if you're not sure what's causing the problem and check for false, that way if you have a missing value you won't cause errors
no the code gets patched and makes my methods like if i built it from unity it self with the netcode [ClientRpc] public void SendOutScanClientRpc() { NetworkManager networkManager = base.NetworkManager; if ((object)networkManager == null || !networkManager.IsListening) { return; } if (__rpc_exec_stage != __RpcExecStage.Client && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams clientRpcParams = default(ClientRpcParams); FastBufferWriter bufferWriter = __beginSendClientRpc(613653848u, clientRpcParams, RpcDelivery.Reliable); __endSendClientRpc(ref bufferWriter, 613653848u, clientRpcParams, RpcDelivery.Reliable); } if (__rpc_exec_stage != __RpcExecStage.Client || (!networkManager.IsClient && !networkManager.IsHost)) { return; } Scan(); } but it fails to find the keys that i think get generated from the patcher [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_DroneEnemyAI() { NetworkManager.__rpc_func_table.Add(1032796482u, __rpc_handler_1032796482); NetworkManager.__rpc_func_table.Add(202708153u, __rpc_handler_202708153); NetworkManager.__rpc_func_table.Add(2378372690u, __rpc_handler_2378372690); NetworkManager.__rpc_func_table.Add(613653848u, __rpc_handler_613653848); }
@lofty nymph I apologize for ping, I was just wondering if you know what im doing wrong.
you registered your enemy prefab as a network prefab?
oh
nvm i think i know
from the stacktrace it seems like you forgot this part
the generated rpc initialize function is not being ran when the game loads
this is in the netcodepatcher readme
it just runs any function marked with [RuntimeInitializeOnLoadMethod], because unity doesn't do that for mods.
thats wierd its in my code "private void Awake() {
Logger = base.Logger;
MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "droneenemyassets"));
DroneEnemy = MainAssetBundle.LoadAsset<EnemyType>("DroneEnemy");
var TerminalNode = MainAssetBundle.LoadAsset<TerminalNode>("DroneEnemyTN");
var TerminalKeyword = MainAssetBundle.LoadAsset<TerminalKeyword>("DroneEnemyTK");
NetworkPrefabs.RegisterNetworkPrefab(DroneEnemy.enemyPrefab);
RegisterEnemy(DroneEnemy, 50, LevelTypes.All, SpawnType.Default, TerminalNode, TerminalKeyword);
Logger.LogInfo($"Plugin {PluginInformation.PLUGIN_GUID} is loaded!");
var types = Assembly.GetExecutingAssembly().GetTypes();
foreach (var type in types)
{
var methods = type.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
foreach (var method in methods)
{
var attributes = method.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), false);
if (attributes.Length > 0)
{
method.Invoke(null, null);
}
}
}
}"
unless stuff is failing to call somehow
strange, the error definitely implies that the rpcs never got initialized
try adding a log below method.Invoke(null, null); ig
adding that log made everything work :| wat
i bet if you remove it it will still work
i have a feeling it just failed to compile last time or something and you didn't notice, or it didn't get copied over correctly idk that kind of stuff has happened to me way too often lol
no worries
hey guys, what is the range of values for rarity when registering an enemy? I currently have my custom enemy at 100 rarity, and I have no idea if this is high or low.
oh yeah that reminds me of, I should add info about rarities into my guide. Right now though, I barely know anything about rarity.
range is 0 - 100
in basegame
Could I be a huge pain and humbly request that your patches in Dungeon.cs stop running if LLL is loaded? would do it on my side but not sure how I can
Okay simple question, im doing my own thing now (creating my script) my only question is what are the key differences between Door.cs and DoorLock.cs ( I want to inherit one of these two but dont know if there is a major difference)
make a pull request ig
Hi, I was wondering if there's any examples or documentation regarding on how to create custom weather with lethallib? I had given a look through lethallib's code but I'm still having a hard time understanding at how I could approach this
usually people forgot to setup their post build copy target to depend on NetCode patch target
that, but also quite a few just don't understand how the csproj files work
Is creating moons possible with lethallib?
LethalLevelLoader is probably better for this, idk if LethalLib has this
Yeah LethalLevelLoader is the lib for moons/dungeons, LethalLib is for everything else, like scrap and handles etc
what is the proper way to make a scrap that works as a weapon? I read something about a shovel script that gets automatically applied if you mark the scrap as a defensive item but even with every combination of two handed + two handed animation + hold left click doesn't seem to do anything. would I need to make a new item prefab that uses shovel script component instead of physics prop on the root?
I keep getting a null ref that doesn't tell me what is the issue! It must be with the prefab right?
is the assetbundle in the correct folder?
your plugin/mod folder for the game itself should have the assetbundle and the .dll
sweet
Like the view model animation
Hey guys, working on a custom enemy, does anybody know what allows an enemy to climb on railings? mine doesn’t and i’m not sure why. already made sure the area mask on my NavMeshAgent is set to “Everything”
i don't think the railings have navmesh baked, but i might be wrong about that
Heya, i'm trying to use the map objects API and when generating the dungeon it spawns 1 object (and its custom component Awake() fully finishes), but then throws this error
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
(wrapper dynamic-method) RoundManager.DMD<RoundManager::SpawnMapObjects>(RoundManager)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Trampoline<RoundManager::SpawnMapObjects>?-512036168(RoundManager)
LethalLib.Modules.MapObjects.RoundManager_SpawnMapObjects (On.RoundManager+orig_SpawnMapObjects orig, RoundManager self) (at <4eedb4dc36094adcb65137cf81f2803d>:IL_009D)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Hook<RoundManager::SpawnMapObjects>?1397977128(RoundManager)
(wrapper dynamic-method) RoundManager.DMD<RoundManager::GeneratedFloorPostProcessing>(RoundManager)
RoundManager+<LoadNewLevelWait>d__115.MoveNext () (at <af9b1eec498a45aebd42601d6ab85015>:IL_013C)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e27997765c1848b09d8073e5d642717a>:IL_0026)
not too sure how to even debug this error, could it be a problem with the prefab? i've only got the fbx model in a parent gameobject, adding a custom component after loading from the asset bundle
wait i didnt add a network object, thats probably required 💀
it was lol
in the noisemaker script does this Trigger animator thing give the item animation?
Can RegisterEnemy only be used once? It seems that RegisterEnemy is only registered for Experimentation.
int[] numbers = shrimpSpawnWeight.Value.Split(',').Select(int.Parse).ToArray();
LevelTypes[] levelTypes = {
Levels.LevelTypes.ExperimentationLevel,
Levels.LevelTypes.AssuranceLevel,
Levels.LevelTypes.VowLevel,
Levels.LevelTypes.MarchLevel,
Levels.LevelTypes.OffenseLevel,
Levels.LevelTypes.RendLevel,
Levels.LevelTypes.DineLevel,
Levels.LevelTypes.TitanLevel };
for (int i = 0; i < numbers.Length; i++)
{
Levels.LevelTypes levelType = levelTypes[i];
LethalLib.Modules.Enemies.RegisterEnemy(shrimpEnemy, numbers[i], levelType, Enemies.SpawnType.Default, shrimpTerminalNode, shrimpTerminalKeyword);
Plugin.mls.LogInfo("Shrimp spawn chance in " + levelTypes[i] + ": " + numbers[i]);
}
LethalLib.Modules.Enemies.RegisterEnemy(shrimpEnemy, shrimpModdedSpawnWeight.Value, Levels.LevelTypes.Modded, Enemies.SpawnType.Default, shrimpTerminalNode, shrimpTerminalKeyword);
Plugin.mls.LogInfo("Shrimp spawn chance in Modded Moons: " + shrimpModdedSpawnWeight.Value);
https://github.com/EvaisaDev/LethalLib/blob/main/LethalLib/Modules/Enemies.cs shouldent just be experimentation
this is all i do for my drone enemy and it works on other moons```cs
Logger = base.Logger;
MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "droneenemyassets"));
_harmony = new Harmony(PluginInformation.PLUGIN_GUID);
InitializeConfig();
DroneEnemy = MainAssetBundle.LoadAsset<EnemyType>("DroneEnemy");
var TerminalNode = MainAssetBundle.LoadAsset<TerminalNode>("DroneEnemyTN");
var TerminalKeyword = MainAssetBundle.LoadAsset<TerminalKeyword>("DroneEnemyTK");
NetworkPrefabs.RegisterNetworkPrefab(DroneEnemy.enemyPrefab);
RegisterEnemy(DroneEnemy, spawnWeight.Value, LevelTypes.All, SpawnType.Default, TerminalNode, TerminalKeyword);
Logger.LogInfo($"Plugin {PluginInformation.PLUGIN_GUID} is loaded!");
/// <summary>
/// Registers a enemy to be added to the given levels, However it allows you to pass rarity tables, instead of just a single rarity
/// </summary>
public static void RegisterEnemy(EnemyType enemy, SpawnType spawnType, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null)
{ /*...*/ }
/// <summary>
/// Registers a enemy to be added to the given levels, However it allows you to pass rarity tables, instead of just a single rarity
/// Automatically sets the spawnType based on the enemy's isDaytimeEnemy and isOutsideEnemy properties.
/// </summary>
public static void RegisterEnemy(EnemyType enemy, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null)
{ /* .. */ }
Hi all! Is there anyone who could talk me through the c# section of the LethalLib item video? I'd like to start porting items from LethalSdk but need some guidance the first time through. Any help would be appreciated!
The best way to learn -
- Watch it yourself
- If you don't understand something, pause the video + rewatch the relevant part until you figure out a search term / AI prompt
- Google / ChatGPT your search term / prompt and read around.
- If you don't understand something that comes up, google / chatgpt that too.
- If at any point you spend more than 10 minutes on a single topic, ask about that topic in #dev-general
Once you're happy, try to follow the tutorial or the one on https://lethal.wiki - again, asking questions when you encounter specific issues or things you don't understand
@lofty nymph I opened a pull request to fix enemy registration with rarity tables in LethalLib: https://github.com/EvaisaDev/LethalLib/pull/65
And uhh I guess @neat rose I should mention you too since you made the bug report, in case you have anything to say
Changes look good to me. Thanks for making that PR!
i merged and pushed it
By the way if people want to take over maintaining lethallib i can add collaborators.
The repo has workflows for automatically building and making releases on nuget and thunderstore, and at this time I do not have the energy nor do i feel like maintaining it myself, because i have a lot of other stuff to deal with.
Reply to my DM 😅
oh i missed that, but my point still stands- it is nice to have more maintainers
I added some null checks, mostly related to registering enemies: https://github.com/EvaisaDev/LethalLib/pull/67
If you want to, you can add me as a collaborator :3
done, if you need to push updates just make a github release with the appropriate version tag / description (without any files attached) and it'll automatically build and push to thunderstore/nuget
try to avoid making changes that break backwards compatibility
(things like changing function parameters/types will do this, but i assume you know that, this is not a call out, just mentioning it)
anyway i sleep now
also can you check out this issue and inquire when you have the time, it could be unrelated but shrug #66
okay, thank you and good night!
i hate when people give minimum context and no logs
i kinda just stopped looking at github issues a while ago
yeah, I think there might have been a bug that for some reason now not having a ScanNodeProperties thing caused a crash (in Terminal_Start), but I don't know why it wouldn't have before
though, I think the crash they are talking about is different
maybe because stuff wasn't being registered, and it only affected a mod that used this registry thingy
and said mod didn't have a scan node properties component on a object
shrug
even then though, I have had an enemy that didn't have a scannode component and I don't think I had issues. And one person in #dev-general general also said it only happened now since the new update when they also didn't have that, and the enemies were being registered. Dunno
yeahh i don't think i have ever had the issue either with enemies
scrap did have that issue
if scan node properties are missing from scrap it throws an error i know that much
dont think i have ran into it with enemies
@lofty nymph I know you probably don't mind but figured id ask since your active here rn,
Any functional reason your using monomod for your patches? or just preference
preference, i come from the risk of rain 2 modding community which basically only uses monomod
yeee ez
i find it more intuative personally
I have only modded LC, but I find Monomod cleaner and easier
since post and pre patches are a single patch with monomod mmhook
im one of the only people it really affects but it sucks for mods that need to know what content is from vanilla and which content isnt because i cant easily slip my patch in before yours
lol
Well, would it be a problem to make LethalLib do things slightly later?
yeah tbh
lethallib's execution of stuff is weirdly fine tuned iirc
if needed ill prob just push a event or something that i can use maybe
my ass dying because i need to juggle lethallib being too early for me (cuz of the monomod thing) and lethal expansion being way too late for me (cuz they use terminal start)
I guess we could also write a BepInEx patcher to allow hooking to the first mod that ever loads or something, there are ways be first
oh yeah theres def routes
also would have been super convienent for unity to have a way to check if an asset came from a bundle or not but
¯_(ツ)_/¯
btw I am working on a tool called AutoHookGenPatcher which is basically just a better HookGenPatcher which would allow any mod to reference any other MMHOOK file and it would automatically generate that file
it's basically done, just needs more testing
idk what that means
lol
how would you know what file to generate the mmhook file from
it reads every plugin's assembly to find the files they reference
so, pretty simple
yeah that's why I made a cache system so it can do it in 20ms for me cus it doesn't need to do anything other than check the cache and when files were last modified
So it's faster than HookGenPatcher, which isn't very optimized because it reads all MMHOOK files
that reminds me, i had a remake of lighterpatcher which was more dynamic
..somewhere
huh
zamn
how did the item id stuff go in current lethallib btw
remember you being somewhat in the middle? of that before you stopped talking as much
wdym? the fixing ids shifting in saves thing?
it kind of worked but it had a tendency to break a lot so i just have it disabled with a config option to enable it
yee
so valid
Okay, it appears that there are more issues related to registering enemies
Issues:
LevelTypes.Alloverrides spawn valuesLevelTypes.Moddedis required to register enemy to any modded moon, ifLevelTypes.Allis not setLevelTypes.Modded's rarity is never applied, 0 is used instead- To have a rarity other than 0,
customLevelRaritiesdictionary must contain level name, and its rarity will be used
I can work on fixing these
I guess I'll try uploading the null check fixes to thunderstore by making the github release thing
...or maybe not, damn, the thought of breaking everything is a bit scary lol
Okay, maybe I'll do it, and I really hope nothing breaks, and if everything breaks, I'll just fucking die 💀
I did it, and I'm scared lol
I don't think I broke anything 
has anyone run across this before?
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
GetMadEpic.Plugin.Awake () (at C:/Development/test/LC-ExampleEnemy-main/Plugin/src/Plugin.cs:156)
UnityEngine.GameObject:AddComponent(Type)
BepInEx.Bootstrap.Chainloader:Start()
UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset:OnEnable()
I only get it when I have these lines
156 NetworkPrefabs.RegisterNetworkPrefab(GetMadEpic.enemyPrefab);
157 Enemies.RegisterEnemy(CustomEnemy, BoundConfig.SpawnWeight.Value, Levels.LevelTypes.All, Enemies.SpawnType.Default, CustomEnemyTN, CustomEnemyTK);
I have the dll for lethallib referenced in my csproj file and the dependency attribute for it
hope it's not something stupid that I missed 🙃
NEVERMIND IT WAS SOMETHING STUPID THAT I MISSED
ModAssets.LoadAsset was loading assets with the wrong names 🙈
[Error : LethalLib] An Enemy AI Collision Detect Script on GameObject 'TheDog' of enemy 'Shrimp' does not reference a 'Main Script', and will cause errors!
@lofty nymph
this error message is my doing
do the enemies not cause errors then?
I guess they might apply the reference afterwards
however, that error doesn't mean anything, it is just a warning for developers making custom enemies, since that is like one of the most common errors people have when making them
Not sure just seen this wiz by in console while i was looking for something else
Yeah I can take a look at the source code of LC Office (it is that mod, right?) to see what they do
yea its lc office
also is there a page dedicated to help?
trying to find the root of a problem
Okay, so here is why that warning is triggering, the AI script is added afterwards LethalLib does the check
Enemies.RegisterEnemy(shrimpEnemy, shrimpSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, shrimpTerminalNode, shrimpTerminalKeyword);
// ...
shrimpPrefab.AddComponent<ShrimpAI>();```
don't worry about it, there is no real problem
I should probably make the warning be a warning instead of an error though
no no this isnt my problem i found this while looking for my problem, #modding-general message
How do i make a scrap have a two handed animation? i enabled the Two Handed and Two Handed Animation bools in the item component but its not working
Anyone ever had a bug where anything is independet from the prefab after using Instantiate, except the itemProperties. They're the exact same object for all of my GrabbableObjects i instantiated. AudioSource, NetworkObject, Collider, MeshRenderer are all unique like they should be
thats not a bug
that's just how things work
all instances of the same item share their itemProperties instance because that's a ScriptableObject
while components are unique
That seems perfect for most cases 👌🏻
In my special case it was problematic, because i wanted to change the itemProperties.weight at runtime (for a GrabbablePlayerObject), so that when someone grabs another player the weight is automaticly applied correctly.
Can Instantiate the itemProperties now or don't touch itemProperties.weight and do it manually with a NetworkVariable.
Thanks for the explanation :)
i recommend against instantiating clones of itemProperties because it might cause issues with potential mod compatibility, if another mod for example needed to change something about your itemProperties for some compat reason.
The whole point of scriptable objects is that you can change them in a single place and they affect every object that uses it
just food for thought
good input, didn't knew about that and seen them as single properties rather than an "instance" till now. I will set it on the list of things to rework for the next version of my mod
How has the 🧙♀️🔮⛏️💎👾🪐🏹 mod been going
(Dome 🔑per)
You fit right in with the noita community with that amount of crypticness
Its been going fine, massive headache tho because of how much the noita lua sandbox limits you
Understandable. Don't really follow really Noita modding stuff myself. I've seen a few crazy things, but this one really pushes the limits. Looking forward to it though.
And games with cryptic secrets are top tier
https://github.com/EvaisaDev/LethalLib/pull/69 I can merge this tomorrow after a bit more testing if no one has anything against this. Anyways, seems to work fine so far
we're getting this error after creating a networkprefab and adding our network behaviour object as a component to it with lethallib. we then spawn the NetworkObject at StartOfRound.Start() but for some reason it's still null
we are completely new to networking and using lethal lib btw
Is the "IsMeltdown" variable a NetworkVariable? Some code for MeltdownChanceBehaviour.IsMeltdown or the Display.. method that calls it could help finding the cause
does this include custom level map objects or just enemies & scrap
it is a network variable yes
Is it initialized with new NetworkVariable<>?
we initialize it with new() in there
then in the plugin's Awake() we call this:
{
MeltdownChanceManagerPrefab = LethalLib.Modules.NetworkPrefabs.CreateNetworkPrefab("MeltdownChance Manager");
MeltdownChanceManagerPrefab.AddComponent<MeltdownChanceBehaviour>();
}```
and then as a postfix on StartOfRound.Start() we do this
[HarmonyPostfix]
public static void OnSessionStart(StartOfRound __instance)
{
if (!__instance.IsOwner) return;
try
{
var MeltdownChancetManager = Object.Instantiate(MeltdownChanceBase.MeltdownChanceManagerPrefab, __instance.transform);
MeltdownChancetManager.hideFlags = HideFlags.None;
MeltdownChancetManager.GetComponent<NetworkObject>().Spawn();
MeltdownChanceBase.logger.LogError($"Spawning MeltdownChanceBehaviour.");
}
catch (Exception e)
{
MeltdownChanceBase.logger.LogError($"Failed to spawn MeltdownChanceBehaviour:\n{e}");
}
}```
sorry i didn't respond he does all the code lol
idk if it has anything to do with our mod, but this gets logged to console immediately after our override OnNetworkSpawn() is exectued:
[Warning: Unity Log] damageTrigger is disabled! Netcode for GameObjects does not support spawning disabled NetworkBehaviours! The InteractTrigger component was skipped during spawn!
[Info : Unity Log] Client connected callback in gamenetworkmanager
[Info : LethalLib] Found 0 prefabs to fix```
Uhh, I don't know? Would those be like the teleporter trap in lethal things? I can check how that stuff works 👍
yep they are like the teleporter traps.
checked the PR and no changes to mapobjevts so I would assume they still don’t spawn on custom moons
I think it’s a load order problem from when I briefly looked at it before..? LethalLib registers map objects before LLL loads moons
yeah, it is just a load order thing (for other than that the PR also fixes spawn weights applying incorrectly, especially for custom moons)
I can fix this later, should be a simple fix, but it also needs testing because it's also easy to make mistakes so it's not coming in today's update
yeah no worries, thanks for fixing it :D
I'm excited for today's update 
lol, yeah I could update LethalLib like right now, but it is a bit scary to do that 😅
But Xu has tested my changes, and it seems to work for them too so it should probably be fine, I hope :3
I wish there was an easy way to release beta versions (on Thunderstore) for people to test, it would make life so much easier lol
I mean you could always upload a seperate release and name it LethalLib Beta or LethalLib Experimental if need be, but if Xu ran into no issues with the update then I imagine the new update should be okay ^^ I'll be playing with it on stream later so if anything breaks it'll happen live 😅
I just wonder what black magic the Scopophobia dev did to make shy guy spawn everywhere lol, I love how that's the only mod that doesn't need the fixes coming today
Well, I guess I'd need to ask eba about it, but also I'm not sure if there will really be that many new LethalLib updates that it would make too much sense bother with doing that. But I guess I can release the update now and we can hope for the best lol
🙏
I believe
It's not the only one, those mods made their own spawn logic rather than using LL's, dunno why tho, should've reported this as a bug
Also @raw fiber
Here's ur ping
Ah there's more than that one? I only knew the Shy Guy one did it, idk why they never bug reported it tbh
damn, why is git so hard to use 😭
I do one thing, and then I didn't do something, and then I want to undo what I did so it would let me do a thing, but I can't figure out how to fucking undo. This is of course partly a skill issue, but damn
Hehe skill issue
Just Google it baka
Feel my wrath
eh fuck it, I'm gonna delete my repo from my machine and pull it again from github lol
git is too confusing 😭
You're missing out on the opportunity of learning
bruv I'm just trying to merge a single fucking commit, I didn't sign up for for a fucking puzzle where I'm trying to get my thing to a state where it allows me to do anything 😭
I do love git merging
Did you stage your changes?
bruh yeah I did push my previous changes (at least the code changes I did I pushed), then I tried rebasing and then I've missed some step or whatever and it doesn't allow me to do it and then I try to undo and I don't know what the fuck that does and then I can't stash my changes away (because there aren't any), I can't checkout to another branch, and I don't know what to do. Totally a skill issue though
In that scenario I usually make a random change like adding a new line and commit again, works
okay, so what I did was I tried merging EvaisaDev:main into my main branch, but yeah I don't fucking know. I just used the sync fork button in GitHub to do that instead
yeah I really need to learn how to use git lol
well its not in thunderstore yet it seems ?
but ty
okay I remembered to write the changelog 
the new version is now being uploaded, I sure hope nothing explodes :3
I believe in you Hamunii ^^ it won't break and if it does then Lyra will lyk ig XD she likes to let people know when things break 😆
haha, thanks :3
The new version seems to be up on Thunderstore now btw
is this something that has happened before?
Yeah, it's rare but when it happens the ship won't land and gets stuck on random seed
I should state maybe you already fixed that cus that's happening with 0.14.4 lol
huh, it comes from the game code, and for some reason tries to access a thing in the list which doesn't exist (Index was out of range). I dunno if that's because of a mod or if it is just a bug in the game, but I can look into that 👍
👍
That bug happened to me when I tried to patch in adding something to the map objects array on my own before realizing LethalLib does it already
Although having a hard time figuring out how to make that work, documentation is still pretty spotty lol
@raw fiber
Is there a specific place or way I should be calling MapObjects.RegisterMapObject? When I use it and then land on a moon I get this error:
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
(wrapper dynamic-method) RoundManager.DMD<RoundManager::SpawnMapObjects>(RoundManager)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Trampoline<RoundManager::SpawnMapObjects>?-1724232704(RoundManager)
LethalLib.Modules.MapObjects.RoundManager_SpawnMapObjects (On.RoundManager+orig_SpawnMapObjects orig, RoundManager self) (at <a195ca621c6e43699e5855ec3dd9dd63>:IL_009D)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Hook<RoundManager::SpawnMapObjects>?1359250684(RoundManager)
RoundManager.GeneratedFloorPostProcessing () (at <af9b1eec498a45aebd42601d6ab85015>:IL_000F)
RoundManager+<LoadNewLevelWait>d__115.MoveNext () (at <af9b1eec498a45aebd42601d6ab85015>:IL_013C)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e27997765c1848b09d8073e5d642717a>:IL_0026)
Here's the code I call from the Awake function of my plugin
private static void RegisterMapObjects()
{
var def = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
def.spawnableMapObject = new SpawnableMapObject
{
prefabToSpawn = ShardPrefab,
};
var curve = new AnimationCurve(new Keyframe(0f, 2f), new Keyframe(1f, 6f));
MapObjects.RegisterMapObject(def, Levels.LevelTypes.All, _ => curve);
}
ShardPrefab isn't null, which I've already checked for
ty!!
Hi i was wondering if anyone knew what was causing this, I saw someone mention LethalLib does it. I get stuck on random seed screen after going to a LECore Moon > Orbit > quit to Main Menu > reload save > try to land again; it fixes itself if i restart the entire game or go to a diff moon.
This seems like a LethalLevelLoader issue from the stack trace?
Seems like one of the mods you have has a faulty interior, hard to tell though
Don't you mean for them to fix their mod? 😂
i've seen good games with less code, just fix it batby
Lol
@brittle marsh thank you so much again 
time to gather the gang and play lc again all day
haha, no problem :3
Have you not had any issues with the abandoned tzp? I remember some were still reporting problems with it
@lofty nymph any chance you can help, if not its ok ❤️
everything worked fine for me thanks
we figured it out mostly
When registering scrap item rarities to override with the customlevelrarities constructor, it looks like we can't specify vanilla moons. Is this intentional?
i.e. if we specify a scrap item to only be on titan for example, and have a config setting to allow players to set spawn rarities, who want to make it spawn on experimentation, we can't do this via the customlevelrarities param
Are we supposed to adjust the enum parameter passed in for this, or has this use case been overlooked?
theres a dictionary for normal levels and a dictionary for custom levels
private (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity) {
Dictionary<LevelTypes, int> spawnRateByLevelType = new Dictionary<LevelTypes, int>();
Dictionary<string, int> spawnRateByCustomLevelType = new Dictionary<string, int>();
foreach (string entry in configMoonRarity.Split(',').Select(s => s.Trim())) {
string[] entryParts = entry.Split('@');
if (entryParts.Length != 2)
{
continue;
}
string name = entryParts[0];
int spawnrate;
if (!int.TryParse(entryParts[1], out spawnrate))
{
continue;
}
if (Enum.TryParse<LevelTypes>(name, true, out LevelTypes levelType))
{
spawnRateByLevelType[levelType] = spawnrate;
Plugin.Logger.LogInfo($"Registered spawn rate for level type {levelType} to {spawnrate}");
}
else
{
spawnRateByCustomLevelType[name] = spawnrate;
Plugin.Logger.LogInfo($"Registered spawn rate for custom level type {name} to {spawnrate}");
}
}
return (spawnRateByLevelType, spawnRateByCustomLevelType);
}
this is what i use
https://github.com/XuuXiao/GiantSpecimens/blob/main/Plugin/src/Plugin.cs
if you'd like to see the full thing for registering etc for me
Ah yeah this looks like what I was looking at for an alternative
Specifically the last enum parse, thanks
same here, it only started to happen recently but its semi-often (1 in every 5 landings)
is there even any mention of lethal lib in this?
[15:08:19.2143667] [Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
SCPCBDunGen.SCPCBDunGen+RoundManagerPatch+<>c__DisplayClass1_1.<AddConversions>b__1 (Item x) (at <17c920b375414721a96e8ff8464ca52a>:IL_0000)
System.Collections.Generic.List`1[T].Find (System.Predicate`1[T] match) (at <787acc3c9a4c471ba7d971300105af24>:IL_000D)
SCPCBDunGen.SCPCBDunGen+RoundManagerPatch.AddConversions (SCPCBDunGen.SCP914Converter SCP914, System.Collections.Generic.List`1[T] lItems, System.String sItem, System.Collections.Generic.IEnumerable`1[T] arROUGH, System.Collections.Generic.IEnumerable`1[T] arCOARSE, System.Collections.Generic.IEnumerable`1[T] arONETOONE, System.Collections.Generic.IEnumerable`1[T] arFINE, System.Collections.Generic.IEnumerable`1[T] arVERYFINE) (at <17c920b375414721a96e8ff8464ca52a>:IL_0110)
SCPCBDunGen.SCPCBDunGen+RoundManagerPatch.SCP914Configuration () (at <17c920b375414721a96e8ff8464ca52a>:IL_0104)
(wrapper dynamic-method) RoundManager.DMD<RoundManager::SpawnSyncedProps>(RoundManager)
RoundManager+<LoadNewLevelWait>d__115.MoveNext () (at <af9b1eec498a45aebd42601d6ab85015>:IL_0129)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e27997765c1848b09d8073e5d642717a>:IL_0026)
latest error was this
which is SCP dungeon
not related to LL
and other errors was calculatepolygonpath
which is probably from wesley's moons if you were playing em
sorry, I was just going through all mods that I have installed 1 by 1, saw that someone has the same issue in here
I dont
@brittle marsh is a patch coming for v50?
If things are broken then yeah, in a day or two
i could see some of lethallibs code breaking
Btw, it seems for LLL the config doesn't load and the terminal breaks so you might be able to salvage it
You got this
I'll disable my stuff that relies on it for now cus I wanna check out the new moon tn
the actual changes are fine its small changes to very crucial stuff lll touches
Ahhhh
I believe in you 🙏 if you can get a patch out tonight I will quite literally wait
lol
There is some mod throwing this error though
if this happens ill be amazed, patching stuff for new versions can be a pain sometimes xD
NOO ARSON AND MAXWELL AND COOKIE FUMO
:((
Yeah it works but seems quite a few things are brokey lol
biggest thing is RoundManager.dungeonFlowTypes is no longer an array of DungeonFlow but an array of IndoorMapType which just has a DungeonFlow and tilesize
maybe when L lib is fixed it will work?
I really dont wanna play without that mod
Oooo hopefully xD
I don't think so, the networking feature of LT is dead
NOOOO
other scrap mods and stuff are working fine
Ruining my hopes and dreams like that xD
Sorry
I would pay someone to fix it
np
no joke
wasnt there someone doing mod commissions, or am I thinking of a dif server
wait @tough path you do comms right? although I dont wanna bother you now as you seem quite busy maybe sometime in the future
where is it, id like to take a look
wanna support the good devs
lol, yeah I'd like to focus on finishing my MonoMod patching article for lethal wiki instead of fixing LL
could help to send the logs to see what's actually going wrong, otherwise we can't really help
ill let you know once this is fixed 😛
💀
got lll working, can prob look at ll tonight
Ayyyyyy
let's goooo
is the LLL update pushed?
it looks like a MonoMod style patch to RoundManager.Start() in LethalLib causes it not to run, meaning that timeScript is perpetually null and causes error spam (and possibly also failure to spawn enemies)
it claims to be caused by the dungeonFlowTypes field not being found, though that field does exist, so maybe something was changed about that and it causes a type error
yeah
yeah this update isn't very invasive it appears
all my mods seem fine, even one where they fixed an issue that mine fixed also lol
doubled up null check but it's nbd
(also, your working on LethalLib to update it is much appreciated!)
Agreed, how is the LethalLib update coming btw? @tough path ^^
Last i heard id be out soon
like few days
may be wrong lol
That was Hamunii's words, Batby is taking up doing the update instead
ahhhh
gotit
So the issue is
The version for v50 won’t work on v49
Not sure best way to even theoretically release it
Hmm
Maybe just have it ready for v50?
Release it as LethalLib Beta maybe?
Yeah
and say to only use it if playing with v50 beta
then push changes to stable when V50 officially launches
actually hmm
Deprecate it when the release comes out
I have an idea
oo?
Okay lmk 
if the update is gonna be pushed I'll wait to stream again tn til after it's out
I gotta cook abit more lll stuff anyway cuz ideally i want lll in a position so if full release drops i can drop within 12 hours
good idea
Noice, I look forward to the LL update and your big LLL update when V50 drops out of beta 💜
I expect v50 will be soon tbh
With how little bugs there actually are
I am not sure if I like that or not xD
I havent even started on making models for new scrap for my moons yet
I should start doing that soon so im ready to make the items quickly after LLL update gets released
After you get your poor moon and interior fixed UwU
You got this
sector-0 filled with || old birds || is gonna be fun
It will def
If you want a spoiler from when I streamed V50: ||Rosie plans to have some be inside where you can witness them being built||
AWESOME
since they are gonna be outside too id be nice to have garage area the emerge from, maybe containing an additional entrance
LethalLib is causing the game can't spawn the monsters and entities
LL isn't compatible with the beta, you'll have to either downgrade ingame version to v49 or wait until the full release of v50 for LL to update
oh, okay...
at least I can find the alternate ways to enjoy the beta version so that's fine ;p
damn, want to try other moons which made by mods
Patience brings happiness, trust
yeah, gotta wait then, thanks for info
lethallib not being compatible with beta cut my modpack in half 😦
and lll cut the rest out for me lol
The way I'm doing it for my Locker and Malfunctions mod is to already build and push the code to GitHub ASAP and possibly host a release there, then have it already packaged and ready for Thunderstore when the update drops and it's confirmed working.
I think for LL that might also be a good idea because then modders can already download the library and implement it before the release and we can all publish our mods - almost - the moment the update comes out.
that... sounds a like a really good idea actually
Nah, for me. I can find some more interesting of alternative ways to enjoy without it, so I ain’t worry about it.

just wait for the mods to get compatibility :imairfrying:
Would it be possible to add a config option to seperate the loading of custom enemies & custom items in the future, so that in case one of the two is broken in a future release beyond v50, those mods who only have items / enemies may still be able to use it, if the other part is broken?
ah, sad. have you made any progress with the potential fix? :)
may it be possible to fix it from outside, e.g. another mod that only contains the fix?
or is it something that can only be achieved by changing the code inside LethalLib itself?
the latter
dang, so the issue is easy to fix but Thunderstore is making it difficult to upload the fixed version? or am i misunderstanding?
The point is, this is still beta v50. If the game will be updated officially, will these mods work in official, stable new version?
ye
Thunderstore lacks release features to make releasing on a beta viable imo
eg. look at something like modrinth
you can release updates set to their own alpha/beta/release and target them on specific basegame versions
i see, so how does targeting specific versions for a release work?
eg. if we used modrinth i could push a lethallib update that is explicitly marked that its for v50
so people on v49 wouldn't get it as an auto update
ahh, but TStore doesn't have that option?
but now if i push an update to LL for v50 everyone using ll on v49 would get the v50 update and that would break for them
tstore has no options for these kind of things
guessing it'd be a massive pain to get it to work with v49 and v50 too
ah, lack of backwards compatibility sounds like a pain
the changes i need to make are super simple but just due to how this all works i cant make one that works on both
idk how programming pilled you are but one of the notable variables we look at changed its type (which isnt a bad thing)
but it means when lethallib looks at it its now seeing it with the wrong type
so it explodes
updating that is easy but then on v49 the same problem is happening in reverse
hm, would it be possible to make a pop-up that appears when booting the game with LethalLib installed in a v50 updated version that says "if you are using LL on v49, please downgrade it to x version, as this version was made for v50" or something like that?
it'd deal with the backwards compat issue by warning people that hey,k this version's borked for v49
which i dont mind on its own but i do feel that time could be spend working on stuff thats relevant after the beta yknow
very true
yeah, thunderstore is just bad
but another thing is we don't know how long v50 will be in beta
depending on how LLL goes vs. how long 50 goes we could just jump to the beta yeah
just depends
could be a week, could be a year
especially considering that latest patch, seems like Zeekerss very much isn't done with v50 yet
if we really wanted, we could check the game version string or int and depending on that do the specific patches, which would make it compatible with 49 and 50, but yeah not a great solution
even then im not sure
because the referenced assembly is missing a thing then that we need?
yeee
damn
i think it may explode early enough to where its hard to do that kinda thing yknow
i could be wrong!
also wouldn't it then be considering things that are in v50 but not v49?
would it mean exploding in the compiling phase?
yee
unsure how things act when say, it's thinking of what ould be happening with Old Birds but since they don't exist in v49, the mod kinda explodes itself
nah cuz the change itself is minor
the fact it is a change is not minor
i see, mainly just really curious how these things work behind the scene
only way to make it work on both would be with reflection most likely, but I saw that it was erroring in MonoMod hook generation so idk if even that is possible
also reflection is gross
nah turns out i was wrong
oh wait about what part?
ah I see
oh so getting rid of the problematic code will make it work on v50 and v49?
thanks for @brittle marsh and @frank lotus for the help
lmk if yall run into problems i didn't do super mega heavy testing
Will this fix enemy spawns not working too? 🥺
yeah
:o
!!!!
Is LethalThings also being updated for V50 support?
Btw are you also gonna push the LT update?
for V50 support?
If you are maybe you can look into why the current version causes some Networking issues and Hudmanager spikes
:3
batby is saying Lt might not need changes to work now that Ll is updated
Ah
testing with LGU, the enemies now spawn outdoors
is that a good thing
doesn't cause any compat issues
yea, earlier enemies wouldn't spawn
not even the mech army on Embrion would spawn
but now they do
indoor enemies and hazards spawn too, weather isn't broken, seems to be working perfectly
now to test LethalThings
Is LL 0.15.1 compatible with v49? Do interiors work if we stay on v49?
it should be fine yeah
Enemies still aren't spawning for me, but that could be LT tbh
likely, i had no enemies spawning when using LethalThings but they spawned when not using it
any logs
scrap items and hazards spawned fine tho
Nope
It wouldn't log anything
Strangely enough
Still no enemies spawning without LethalThings
So either LethalLib is still broken or an enemy mod is broken
actually, what's your modlist?
Well I had to disable Locker cus it has the int for EnemyPower but
Ignore the Unknown-StarlancerAIFix I was testing a new build for Starlancer
are the enemies inside or outside
No
None spawn at all
Ohhh
SirenHead is outside enemy
GiantSpecimens is outdoor
ok better question
Shy Guy can be either
have you seen enemies that are meant to spawn inside, not spawn inside when they should
Old Birds spawn outside but thats it from what ive watched on Lunx's stream
i mean custom
When I was having enemy spawn issues a while ago Old Birds could "spawn" but they would never activate btw^^
Yeah I had that
@distant flame soundapi goes crazy on the debug logs my lord
Yeah ikr lol
this hotbar mod too omg
@crimson mauve bls fix
some random ass mods go crazy in the logs lol
I took out LethalThings, and they still wouldn't spawn though


