Discussion about my API library which was originally intended for personal use
https://thunderstore.io/c/lethal-company/p/Evaisa/LethalLib/
1 messages · Page 1 of 1 (latest)
Discussion about my API library which was originally intended for personal use
https://thunderstore.io/c/lethal-company/p/Evaisa/LethalLib/
shit right that is a point
Okay so, this:
Well I'm saying that because I had problems adding a custom item due to me not having the right components and scripts and stuff. I'd lean toward automating that part of the process if this was an issue that the end user could face, but it's probably not gonna be a problem with the custom moon
I personally deem user error
should just rename this section to Eva-and-Eba cuz its basically your section
I don't expect the API to set up your prefabs and stuff for you
What we really need is documentation
and a modding wiki
like I said that's not really relevant to the moon discussion anyway
Forwarding from modding discussion
I mean if you want I can focus on code based development and you can focus on unity based development that way both bases are covered
You are right thought documentation would make it far easier
so for a custom moon api my ideal solution is:
the sdk would export all of this as an assetbundle, and in a normal case you'd never need to touch code
if you need code you can always add some plugin extension or something
I’m more for the whole impossible to break method type approach than figure it out yourself approach
I’ve always been that way
Think I said awhile ago I design my utils in my mods to theoretically be transferrable to other projects if someone needs it
it's possible to setup a second "editor-only" assembly that only contains the MonoBehaviours you want to show up in editor
like here
https://github.com/Vadix88/MonkeMapLoader
so you don't have to worry about breaking references
And they should be self explanatory
I want development to feel as close as working on the original game project inside unity as possible myself
rather than doing a bunch of function calls to make stuff
Yeah honestly despite my problems with unity and its stability I'm with you on that
that was my intention
Was pushing for this, maybe I should bite the bullet and set it up
i'm trying to get it worked on on https://lethal.wiki , i think the current modding wiki guys are gonna help port over what they have
it would be fairly easy to add a "modeling" guide there
Yeah stuff like what goes on a item object in order to make it work in terms of components is generic info
it would go for any API and stuff, so we'd need a wiki for that
this isn't a bad idea. I think having two different APIs is justifiable if one of them is for people who are integrating their work with unity and one of them is for people who don't wanna leave VS
95% of people who wanna make a custom moon don't need or want code
or most visuals
The idea in my code is that you fill out fields similar to unity and the code does the rest, that way you have the code for the thing and the stats/fields are in the same class
It’s how spikestrip was laid out whenever the fuck I was working on that
So the workflow is similar
https://github.com/legoandmars/GorillaTagMapProject this is the workflow i've done for previous projects, this is a bit old and has some scuffed game-specific stuff but it should get the general idea across
I’ve worked in both workflows though so personally I’m not picky but I will say dealing with unity errors is quite annoying
However this isn’t as unstable as thunderkit/msu so thank god for that
If I take the item creation part into account
Msu makes me want to kill myself whenever I interface with it
sorry i keep straying away from the moon api
This is basically my design standpoint
Moonapi should be a separate thread tbh
i put 4 assets (made in unity) in a bundle, load it and register it
and it just works
Anyway yeah this is the same kind of workflow that thunderkit has for ror2
I’m all for it as it’s easier to interface with in the long run but also visual studio people don’t always want to learn unity
One big thing in favor of leveraging unity for the custom moon: knowing where certain things are
SkullCrusher was working on a custom moon system as a extension of my library
i think
If you want though I can use my experience of making unity tools for ror2 and try to apply it to making more tools for that instead of just scripts
currently I haven't changed the ship's landing location or the item dropship's landing location, and so I had Laz just make the fbx and then I'd match the relevent meshes to their locations on vow
Like the wizard systems we have which will literally generate prefabs for you (actually foolproof)
yeah, i'm willing to help make tools if people need help
in theory if I can find out how to change the ship's landing location, etc, like I already have with the doors, it should be fine
but at the same time having the level open to help visualize is probably just superior
hmm prefab templates of some kind would be cool
not sure what you are thinking
how's the actual code getting like, put on the item
wuh?
But it’s like fill out information about an object and it’ll generate a prefab with that information filled in with every component you need for that kind of content
oh i see, i thought you were adding custom behaviour
oh yeah that too
Also could probably polish up the enemy side of lethallib I suppose since I’m going to be working on that hard soon enough
some of my items have custom behaviours
Yeah I have like managed to make enemies spawn in the world, but nothing more
I can figure out the rest hopefully
Also need to rethink the way you choose what moons to spawn enemies/items on, currently it is a flag enum
but that would not work with custom moons
My biggest concern with enemies right now is that idk if navmeshes can be regenerated dynamically
Yeah that’s probably relegated to an array or list in code
I know in unreal that's a flag you have to check per-project
it definitely can
They shouldn’t need to be
But that’s an issue with new moons
I just said that
oh sorry, im totally thinking in terms of what I need for WTO
But yeah baking navmeshes are runtime is definitely a thing because procedural generation is a thing
The issue is unless you make some kind of node painter tool you have to make something that prebakes a navmesh
Baking at runtime fucking sucks don’t do it please
this game already mush do some kind of navmesh generation at runtime surely
yup
I guess if it's on for the project it's on for the project
probably not but it should be referencable
and I can just manaually trigger it
Why does zeeks do that it’s so fucking heavy for no reason aaa
Making navmeshes at runtime hurts my soul
well youd need to for the enemy navigation inside the dungeons to work, wouldn't you?
Yeah that’s fair
idk I know OYH uses runtime nav gen but that's just because I'm an asshole and like it when things are easy
Still wanna avoid that as much as possible
Personally some sort of painter is better than a baker cause you can fine tune the nodes
Anyway, next week I've set aside completely for custom AI stuff
We used to have a baker for ror2 and switched to a painter and holy shit did that fix so many issues you couldn’t solve otherwise
I'd love to compare notes and hopefully getting it to work in the context of the custom moons
to be fair risk of rain 2 nav meshes were fucking weird
I really should look at stuff from ror2 modding i see it brought up a lot
I mean allegedly I’m gonna be working on that so idk if you want to or not
Don’t
took a while for people to figure those out
We have horrible tools
sure but they at least have an implementation
Yeah we had to have ros which was discontinued
I don't mind comparing notes. i wanna get this mod out quickly
specifically this is ideally a christmas gift for my friends who worked on the game with me
Thought you were just adding a moon damn
The grind is real
moon, enemies, items
I’m thinking about maybe being able to reverse engineer the painter we use for ror2
hopefully a couple custom item scripts now that I know its possible
To work for lc
risk of rain 2 has a custom navmesh system tho no?
The painter we have now is kinda generic
is the plan for custom moon API to have it be its separate thing or integrate it back into lethallib
It places a gameobject for a node and then bakes them all together into a mesh when you are done
right now the plan is to roll it into lethallib
Hoping that I can get mine out first >:3
are you working a custom moon too?
No but first enemy on thunderstore is something I’ve been striving for
I'll let you have it
oh let me just steal that from you
but I want first moon >:)
I had my enemy basically done
I do not deserve to go out like this
boomba will be real
I am split between working on first enemy for lethal company and first major rorr port mod for ror2
Both kinda are time sensitive
Fuck my life
i thought you were porting risk of rain to lethal company and was wondering how that would work
I do have work so I probably lose the race to boomba
Also I go on vacation at the end of this week lmao
I’ve made enemies in like 2 days though
Can’t be that bad right
anyway im way past late for dnd but when I get home ill start on proper implementation for these moon tools
going to for now go with a "do as much as you can in unity" workflow
If only this game used entity states I’d be all over the enemy modding
add some documentation to explain that part of the process
yeah, if you need any help let me know, i've implemented a custom map mod or two in my day
willing to help with whatever sdk/tooling/smoothness/docs
appreciated
Ror2 enemy creation is something I’ve always been very passionate about (even though it generally blows)
I do not mind writing/setting up a modding wiki
I will probably do as such soon
i've already started one
still very early if there's massive changes to make
waiting for max to port over things from https://github.com/LethalCompany/LethalCompanyModdingWiki/wiki
Through a GitHub site I’m assuming?
just hosted through github pages right now yeah
Ror2 modding wiki is the one thing I enjoy about it so if we can get it similar that’d be great
Iirc it uses GitHub wiki tools to upload new pages
yeah it should be able to get pretty similar, i'll probably mention you whenever it's a bit more setup if you were interested in starting to document things
just uses .md files
Basically I think it’s rigged with an action to add all the pages from the original wiki to the new site we are using
Makes contributing a lot easier
Vs having to pr
I will document things but I would hopefully not have to pr everything I write
Gets super annoying if you need to say edit a thing cause it looked wrong
have there not been problems with just giving full access to the github wiki
No not at all
There’s the weird issue of like having 3 pages on the same topic but that wasn’t caused by that
Most people don’t care to interface with GitHub to that level
And then surface level moderation fixes anything else
hmm, i'll see if i can think about lower-barrier-to-entry ways to contribute like that
Either that or id just request perms so I can push my shit to the wiki
ideally i'd like to be able to retain translation through crowdin
Do not think prs need to be analyzed cause it’s just markdown files
Can’t do too much damage pushing those to main
idk there's like, images
and the site updates pretty instantly
i don't think it would be too bad if there was a delay so people could catch things though
Yeah even the ror2 one has a delay
It’s like once every couple of hours it updates I think
Anyway luckily I’m used to writing unity guides so I should be able to provide documentation quite easily
yeah i'll see what i can do, need to talk to max, get all that ported over
i do agree there should probably be some non-PR way to contribute for normal people that don't wanna make 12 PRs
and the PR setup is probably not ideal rn i think it's mostly org defaults
If I don’t pr stuff soonish just remind me cause I’m kinda busy most of the time and I still wanna like play games and shit sometimes so my time management is like boned
Might be a lot to ask, but i'm completely lost trying to use this and I'd love for someone to make a template vs project that adds just a single item
I'm really new to all this and I feel like there's a lot i'm missing and a lot of stupid questions I could ask and usually I can understand stuff pretty fast when using a base template to learn from. but the mods available using the lib have a ton of content in it and I haven't been able to reproduce anything.
If anyone could do this i'd be really grateful and if not i'll just do it myself when I understand how this whole thing works 🙏
substantive progress on custom moon stuff being translated to the API
some testing on it to do tmr
So @lofty nymph I was thinking of what exactly would make a good modded terminal system to separate content and also not flood the vanilla terminal with a ton of modded things and I kinda settled on an idea I think?
Opening up the terminal instead opens to a “boot menu” where you can pick an “operating system” and ideally each mod would have its own system so you can separate your content into its own section.
Downside is this Might require a rewrite of the terminal system cause I can’t think of something that’d just let it be done with a hook so prolly some icky code
yeaaa i'm not sure
I feel like it’s worth it in the long run
Especially cause the store is like already pretty cluttered in vanilla
I feel like majority of people will want to add equipment/scrap
Also a good way to sort out modded moons
Only other issue I think there might be is unless you completely separate the keyword lists there’s bound to be overlap
Hell theres bunkbed and bunker spider in the base game
I feel like if youre making a custom moon you'd want it to appear at the bottom of the moon list with all the vanilla ones tbqh
but regardless I feel like this is a bit too much for the API to be shouldering especially automatically
out of scope
i'd love some kind of waila type thing where you can see what mod something belongs to, but i'd have no idea how to implement that in a generic way
Too many moons and the moon screen becomes messy
I was suggesting this as a standalone thing
Just remembered chatting about it
oh in that case go for it theres no reason not to
Like I fucking hate addition into base lists for games cause ror2 does that and then you get pages and pages of content in the same section cause it’s all shoved into one section
This was the way to solve the issue imo
i'm unsure how you'd even determine what is added by which mods
unless the mods directly tell your api
Cause I shouldn’t have to scroll for 3 seconds through all the modded equipment to see my furniture options
This was the idea
Well I would assume the mod creator would have to use a call to the custom terminal instead of adding nodes to the base one
Devs make a “softwareDef” or something of that sort
I’m kinda thinking ror2 here for implementation, since I do enjoy the expansion system
Like right now WTO adds a node for the moon itself and then adds definitions for the route verb and info verb
all of this added to the base terminal
here hang on let me draft up something
I would assume it would be like Load and then the name of the mod section the dev sets
This way you can switch easily without having to back out
I can whip up some scriptable objects and stuff when I get home but the issue is implementation into the existing terminal system
If at all using the existing system
Cause it kinda blows from what I’ve seen of it
Hmm
so for this "custom OS" are you going to be using the base terminal object, or are you going to make a new one?
because if youre using the base terminal class, I can just create an overload that lets you specify what terminal youre adding the new moon nodes to
assuming youre using the custom one
I can’t tell if I should be using the base terminal system or writing a new one
Idk how flexible the existing one is
Also writing a new one would allow for more customization from developers
Potentially worthwhile
The terminalnode/keyword system isn’t horrible though
im guessing the enemy creation is still a wip
It works
Idk what people expect
You are doing a lot of work making an enemy regardless
Can’t really trim that down a ton without making a unity tool
Which ig I could do
i have a working enemy already, but it is a lot of manual labor
the api only registers it with the game
There’s no way to trim the manual labor really
I can’t wave a fairy wand and generate your ai
nah, it is the same labor the game dev would do lol
Also you need art direction and a general understanding of animators ect ect
Fucking got beat by the roomba cause the ai took too long to code
Fail
😭
i haven't released it yet because i am making a carpet 
alright hopping on that first high quality enemy mod bandwagon ig
I can’t work on mine for the rest of the week cause I’m taking a much deserved vacation
So it doesn’t really matter
Don’t think a carpet stalls a week
Just scope creep yourself idk
hacking tool i doubt i am gonna finish before i release what i have because it requires UI work
ihateUIihateUIihateUIihateUIihateUIihateUI
guh
Canvas is free
i did that last time
Idk what you mean unity ui is intuitive
you don't understand, i am rendering the UI to a mesh
and shit
Does it cover ship upgrades or am I still writing code for that
do you have a repo for adding an enemy i saw you say you managed to get an enemy to spawn but thats it
Ah the classic screen ui
and need to caculate mouse positions based on the mesh
tho i will probably give up on that part
lol
not released yet
It’s self explanatory just look at other enemies in the game
It’s the exact same process
Which is a lot of work if you didn’t know
Especially depending on how unique your ai is
Cause as far as I’m aware boomba just kinda runs towards you and explodes?
yeah and forgets you exist when you jump over it
lmao
which class is that in i can look at
It’s in the unity project itself
Meanwhile I’m twiddling my thumbs over here writing 2 separate ais
For the same enemy
The pharaohs curse
probably done modding this game after i finish adding my current backlog
I will be dealing with 1 billion questions from people who will give up after 2 days
Yeah happens to the best of us
I’m still running on some random motivation I pulled out of my ass so
i got to play the game for like 2 sessions total that i consider real sessions 😭
none of my friends are ever around at the same time
Yeah happens
Every one of my close friends has a fucked up evil sleep schedule and I have to defeat their 7 evil sleep paralysis demons to get them online together
Also not to mention convincing them to try another game is a whole fucking hassle
I suggested lethal company to my friends literally a day or two after it came out before the popularity surge and like nobody could decide if they actually wanted to play it
So instead I just gifted it to a friend and we played it cause we were bored
The worst part is I
A) am gonna be expected to drop more after this enemy
B) still have to work on a ror2 mod
Then again at this point it’ll be refreshing having a competent game codebase
I’m assuming cause something in your code also depends on it
Oh it was just visual bug epic
You can also just reimport the folder iirc
If you really a psycho
@fresh folio Do you happen to know if
[CreateAssetMenu] works on a managed plug-in in unity?
i ran into an issue where there is no button to create a UnlockableItem scriptable object, because zeekerss just defines them directly in the unlockables list.
so i was trying to add my own like this
However it does not appear to show up in unity
I mean it still needs to be an so
create assetmenu only works if its attached to a SO
i thought it was one
oh nvm
it is not
that explains that
guh
it is just serializable
just make an object then?
hmm? like a wrapper?
yeah
thats my best idea for it
make a wrapper object and then transfer values is probably the best way to do that
@lofty nymph hey so question\
Do we know what the "type" definitions are actually like comparable
like what each number actually means
cause Id suggest putting that in as a dropdown instead
0 is suits
1 is other
lmao
it is exclusively used for save file stuff as far as i could tell
and entirely unnecessary
because could have just had a checkbox
having suits and ship unlockables in the same list is kinda goofy anyway
+1 this makes setup so much easier
honestly I might use a monobehaviour instead, it would let you export the whole thing as one prefab
i'd recommend the other way around
a scriptableobject that holds all your other stuff
otherwise you have useless stuff on your prefab lol feels dirty
✅
as long as it's really intuitive to new users It Works™️
you could prob get rid of a few properties there too, nobody is ever going to need to modify Placed Position/Rotation in-editor i assume
there was something i forgot to do
and i remembered what it was
for a second
and now i forgot again
oh no sorry if that's my fault
honestly
if your willing to put in the effort
I could help chip in a little
but we should probably make a wrapper for every base game so
at least content so
IMO you should be able to create most custom content without importing the game assemblies
and just using wrappers
definitely willing to make some fancy in-unity editors/sdk stuff if yall need the help
same here
I am just sticking with vanilla stuff myself but tools to make things easier for others i guess are always welcome
I'm trying to make a really basic creature with this API, like a copy of an existing enemy or something that can spawn but just stands still. I have coding experience but not modding experience, so just injecting a new creature into the game is my first goal.
I watched the tutorial by Miinxx but it landed me at adding new lines of codes, not full classes. So how far away am I and where could I get some examples to better understand how to mod this game? Currently looking at LateGameUpgrades for some pointers
making a creature is one of the more difficult things, i'd recommend starting with making a scrap item personally
and yeah resources in terms of tutorials and such are kind of limited at the moment, this modding community is very much still in it's infancy lol
groan I dont want to make an enemy tutorial cause its like super broad
and also because it generally requires a lot of time and effort
as well as a good understanding of coding
Will do that then, thought that'd be the case hahaha
There's a few mods that do that, so I think I can figure stuff out
I dont frankly have the time to tell everyone how to make their specific enemy
Id just fucking rot away if I did
the others are generated at runtime
dude
I can't exactly reformat it myself because mod compatibility
idk
sounds like a bad idea lol
i could regex it

surely this won't go wrong
No like genuinely would help mod compat if we made it generated at runtime
i know, the problem is that another mod might want to do the same thing
and you'd have two mods/apis fighting over the display text
depending on how that other mod does things
I dont want to do that
so fake
anyway I thought you were just making a decor item wuh
yeah but i ended up implementing unlockables api
and i guess upgrades are part of that
lol
it also sucks as it will break on any mod that like translates the game lol
I am not sure how to find an insertion point in a way that won't break
oh yeah, it also throws warnings every time ANYTHING makes a noise
especially when mines make noise
thats just the ai freaking out
it logs every tick of every ai's pathing
i love abundant logging!!
i have a few of those myself probably
Cool, unlockables API seems to be working
it also is able to add stuff under ship upgrades now
in a very shit way
lmao
misery
custom moon integration is kicking my ass, made a substantive amount of progress on it but it's not exactly working yet
Moon list is also manually formatted iirc
A number of things are, sadly
Oh max i forgot i wanted to speak to you.
Did you notice someone else posted a mod under the name LethalAPI, and it is just a bunch of code ripped from other API projects (including mine and LCApi) stitched together
just copied code from different mods and changed the variable names basically lol
Got references for this?
i don't really mind because my lib is open source and they at least credited me in the item api file but still feels kind of shitty for someone to make yet another api mod which is basically just other mods stitched together
This made me laugh #dev-general message
Hey Eva, have you ever actually gotten a custom scrap item to spawn inside the factory? I think the items have to be registered with the level's RandomScrapSpawn instances
can totally do this on my fork was just wondering if I was missing something in existing code
yeah
my stuff spawns in the factory
weird okay I'm totally missing something then
let me go look at lethalthings again
lethalthings doesn't handle any of it
lethallib does
Oh I'm looking at lethalthings for an example of an implementation to compare to my own
form a better hypothesis on whats going wrong
Is the git source up to date? version doesn't seem to match latest on thunderstore
whoops
i never pushed
and my local version is ahead of thunderstore
lmao
I'm looking at the code for LethalLib (trying to understand how networking stuff works) and what the heck is On
like On.GameNetworkManager.Start trying to figure out what's adding that, is it some library to work with Harmony or something
is it better than Harmony
I've been able to use Harmony to do what I need just fine
Both are usable interchangeably in most cases, it is just preference
ok cool to know
@fresh folio https://github.com/EvaisaDev/LethalLib/issues/7
Seems like it’s something to do with faulty terminal patches
But I know for a fact my hook wasn’t written poorly
any error in a terminal hook would cause it to stop working
i have had the same thing happen with inventory stuff
That might do it but I feel like I definitely didn’t have an error idk
but i have not had it happen specifically with my hooks
haven't been able to reproduce these issues in terms of the terminal
https://thunderstore.io/c/lethal-company/p/Evaisa/LethalLib/
Hey guys! How do I add this API to my dependencies?
I think you just put this string in the dependencies array in your manifest file
"Evaisa-LethalLib-0.6.2"
Sorry for asking a stupid question but in the scrap-collection area of the scriptable objects what is the min and max value for? Also do scrap items like screws, axles, engines, etc. need IDs?

using this lib for adding scrap but when i load the asset bundle with my item asset it gives me a null ref to a instace of a object and idk what i am doing wrong?
I got it earlier, it was because my path is wrong
Now my issue is that the scrap actions aren't replicated, for example when I switch Items in toolbar it does change visually but the logic says I still have mine equipped
The game picks a number for how much the scrap will sell for from that range, also yes IDs are needed, because mod compatibility. the ID is how the game knows which item is which and should be unique.
uhhh not quite sure what you mean
all scrap needs a physics prop, collider, networkobj, and a gameobject deciding where the scan point is right?
like when I equip my scrap and use the scrollwheel the item doesn't change
the UI is stuck on the same Item and when I drop the item, other players don't see it
I'm the only one who sees that the item is being dropped
Audio source is required
on the root of the object
otherwise the game will error out when switching items
thanks a ton
might be the same issue?
lack of audio source?
okay thx I will try that
is this how the properties in NO component set up?
or do I have it mixed up
or doesn't it matter
this looks good
also more indepth, the scannode child object should have all this
essentially a box, with a collider, and a Scan Node Properties script
it does, and AS Comp was the problem after all, it works perfectly now
I have one more question..
hmm?
So I wanna add my inherited GrabbableObject class, how do u think I should approach that, should I dynamically add it in my mod.dll or should I add it as a component in the prefab beforehand (the problem is, the behaviour is registered as missing when I compile the bundle)
scripts are not compiled into asset bundles, however there is a way around it
Add the class as part of your mod assembly (the plugin)
then after compiling your mod, drag the mod assembly into your unity Assets/Plugins folder
after that you can use any monobehaviours from your mod assembly directly in unity and in bundles
Do note that if you want to do any networking like RPCs / NetworkVariables you will need to use #1175884865443483689 to patch your mod
Ahh okay, noted, thanks for the response, I'll try that and see how it goes
yeah, just make sure you don't have any .cs files in your unity project itself, they should always be in compiled form loaded from your mod dll
is the "Noisemaker Prop (Script)" component required?
Only for items that make noise
The most basic one is PhysicsProp
by make noise, does that include the drop/pickup sound
No
or like the chatter teeth and robot?
Noisemaker is for things like a airhorn
oh, interact noise
PhysicsProp is for stuff that has no interactions
ah and I see the laserpointer has a Flashlight Item Script instead
any idea what this missing script is
and if it's important?
ah the dentures/chatter teeth have an Animated Item (Script)
I see the items have a .asset thing defined in their PhysicsProp or whatever script, I'm guessing I can just duplicate that for my own object
@lofty nymph I made myself a checklist
These are the components needed for a custom scrap item.
Prerequisites:
I recommend making an empty game object to put these onto.
Required:
And also any one of these:
After you get one of those, you'll see there is a .asset linked in the Item Properties field if you're using the game's existing prefabs.
You'll want to Ctrl+D duplicate one of those to use for your own item, edit it, and link it in that script.
Alternatively you can right click in the unity project file browser, then Create -> Scriptable Objects -> Item
Finally, optionally, you may include:
You can find all of these from other objects in a rip of the game and copy the components over to your new item.
The sound when picking up and dropping your item is defined in the .asset file you duplicated for your Item Properties.
If you want to set up custom interactions when using your item you need to... [idk?]
The .asset is just the extension unity uses for scriptableobjects
It is an editor created script instance which i included in my assetbundle
Scriptableobjects is this system unity has for instantiating classes as assets and configuring them in editor
hmm, I'm not sure I'll fully understand without examples in unity, but I'm guessing I'm fine duplicating one from other items to use for my own
I get a little confused because people use .asset for assetbundles sometimes too
Are you using the unity template with the game scripts?
You can right click in the project file browser, the create -> scriptable objects -> Item
I think they are there but didn't link for some reason
To create the item asset
oooh
Is it only one component? Or any game component
just one
other components seem fine
I just dunno if there's a way for me to read what component it's looking for
It was most likely NetworkObject
nah that one is alright on my stuff
Unity readds it
If it gets removed
Can you show the full inspector?
All the components that are there
Yeah the missing script was NetworkObject and unity added a new one
I had the same issue with the game prefabs
Yup
that must be what that popup I was always getting before was about that kept asking if I want to add a Network Object
didn't know what it meant and I forgot what answer I chose to get rid of it lol
You chose yes lol
Thats what i did

you wouldn't happen to have a tool to quickly clean all that up would you
i sadly do not
i did it by hand
lol
271 files???
oh no i didn't clean up everything
i just clean up the prefabs i need to look at
as i need them
lol
20 files????
Having problems with spawn rate , I set spawn chance value in the config file to 10 as like what u did for LethalThings, but I keep seeing the item every time I encounter a scrap, I want to make this item rare
btw question, will a rarity / weight of 0 ensure an item never spawns, or should I add to my config toggles for different items
I am not 100% on that, theoretically it should mean that
in all honestly, i just randomly guess when it comes to weighting my items
@lofty nymph think you can help me figure out why my custom item isn't loading?
Item StaleBread = ChdataAssets.LoadAsset<Item>("Assets/MonoBehavior/StaleBread.asset");
if (StaleBread == null)
{
mls.LogError("Failed to load Stale Bread prefab.");
}
else
{
LethalLib.Modules.NetworkPrefabs.RegisterNetworkPrefab(StaleBread.spawnPrefab);
LethalLib.Modules.Items.RegisterScrap(StaleBread, configStaleBreadRarity.Value, LethalLib.Modules.Levels.LevelTypes.All);
}```
I've tried loading the .asset file and the .prefab but neither seem to work or I'm just not understanding how unity is mixing around the filepaths of my assetbundle
I've confirmed the AssetBundle does load (or at least it isn't throwing null at me...)
I've tried several different paths besides "Assets/MonoBehavior/StaleBread.asset" after asset ripping my own asset bundle to see how the hell unity structured it...
it lowercased the folders I added and moved my sound files and everything to other folders... or did it? is that just because of asset ripper?
even if I just go with the folder structures as I made them in unity, nothing is loading
"Assets/Import/StaleBread/StaleBread.asset" was my original folder structure, it doesn't load either
but man I just can't load this item
I'm also getting this error, dunno what it means but I'm not doing anything with enemies
is this MMHook something your api requires? I didn't see any mention of it on the github readme
oh, yeah
it is hookgenpatcher
hookgenpatcher generates the MMHook assembly
I just got around to putting that in and it got rid of that error
but my stale bread still won't load :c
any other error?
no other errors except the one from my plugin
which is?
if (StaleBread == null)
{
mls.LogError("Failed to load Stale Bread prefab.");
}```
is there a way for me to peek into my asset bundles and see how they're actually structured
I dont know how asset bundle browser is compiling them
you can look at the meta data file it generates next to your bundle
if you open it in a text editor it'll have a list of all the asset paths
hmm
- Assets/Import/StaleBread/StaleBreadItem.prefab
Dependencies: []
it looks like it didn't include my item asset
if you click on the asset in unity
in the inspector on the right, at the bottom
does it show a bundle
if not, click that dropdown and add it
ah
ahhhh
that said "auto" before
but the asset was listed there
I guess asset bundles have some kind of fuckery about that
I notice my included sound effects do not show as being in the asset bundle
Is that gonna be a problem
is that why I couldn't load sounds from an assetbundle before
why does asset bundle browser show all the stuff from me prefab as being in the asset, but not actually include them... or does it? I asset ripped my bundle and the sounds were actually there... just moved into another folder
wtF
ANYWAY
My loading error is gone, so it looks like the stale bread loaded
I found it, now it's stuck in the floor, ungrabbable, unscannable... hmm
I was able to scan it from below... or rather in that spot I can just scan it, unlike the ones in solid floors
Still cannot grab it though
Dunno why it's rotated like that, as it isn't like that in unity. Though my model in unity has -90 X rotation to be upright... I guess the game or asset bundle browser is zeroing its rotation
nope... even after rotating my model in blender to offset unity rotating it, the rotation is still fucked up somehow
still can't pick it up either
what
Okay so
As for the rotation, the Item scriptable object has a rotation offset and a resting rotation
As for why you can't pick it up, probably because either your collision box is wrong, or the item doesn't have the correct tag / layer
also check that it is marked as grabbable on the component
yup thats your problem
uhh it should not matter
but make sure the scannode is tagged correctly too, it has a different tag iirc
no wait same tag, different layer
lol
Okay I'm getting there
There's a glitch... the drop/pickup or switch-to sound is playing twice
that's.. new
i do not know about that particular issue
I rotated a bread in my scene but it didn't match so it must also be based off the scavenger's wrist... so I suppose if I grab the player prefab and pose it I can make a precise holding position
i don't know if that is accurate
can the mod rotate it?
yeah
that sounds like it'll be easier then
if you find the object in the scene, you can use the PhysicsProp component to get the Item scriptable object
and if you change the offsets in there, it'll update immediately
skip to 1:25
that is so weird
Looks like the offsets to the player model in unity are fairly accurate
The scavenger has a second set of arms separate from the body... I presume are the first person model
an issue i ran into a lot is that first person model vs third person model is not aligned the same
screw third person
for things like guns it is really obvious
I guess my only problem now is the sound duplication
doesn't seem like it's that
@lofty nymph are you using .wav? .mp3? .ogg? any special settings?
i am using all 3 in different places
no settings changes lol
urgh
so this glitch is happening for no reason
on top of that, when I pick it up off the ground, the sound only plays once, consistently
so only the other two are glitched
Do items always just rotate to the same dropped rotation? lmao
it's kind of funny making all this bread align in the same direction on the floor
what are they pointing towards...
yeah
game is goofy like that
i think it rotates to Resting Rotation
it's easy so I guess that works
I'm not sure how I would begin to diagnose the sound duplication
do you have multiple of the same sound assigned here for different things?
if so, i would start with checking that by removing everything except grab sfx or something for example
other than that, i really don't know
I'm gonna head to bed now
cya
I see item drop sounds have Preload Audio Data* set... and that's the only difference, so I'll try adding that
Nope that wasn't it
Other items in the game have this on their audio source
Mines had this instead
That didn't fix it though...
how do u handle intergrating the spawn chance then? like how does it work
okay the double sound glitch... I tried using default sounds from the game itself and those doubled up too
I used shovelpickup and dropmetalobject2
I tried recreating the item asset instead of using one I duplicated from another item. The sound still doubles up.
Removing LCSoundTool (another mod) didn't seem to have any effect
Removing the pickup noise (so there's only a drop noise) - the drop noise still duplicates
But the logs only show it calculating a drop once...
I added a pocketing noise, that one gets duplicated too
wtf
it's only the custom item too, normal game items are OK
I tried installing another mod using your library (Cirno Fumo Scrap) and that one's sounds work fine...
WTF
hey @proper epoch you made the Cirno Fumo Scrap right?
did you ever run into any sound glitches for dropping/picking it up?
Do you have sfx assigned to both pickup and put down, included in your asset bundle?
yes
#1178447015533871174 message
they play, but they are doubling up
however it doesn't double up when I first pick it up, only when I switch to it in my inventory
the drop sound also doubles up
video here, skip to 1:25
Haven't had anything like that happen, are you accidentally registering the item twice or something?
Nope
No clue then
darn
I've been testing a lot of different things, having trouble isolating what it might be...
I spotted another difference in my item vs the game's items
My bread has this on the mesh renderer:
All other items I looked at had this:
naturally, fixing that didn't fix my sound bug
Double checked tags/layers?
yea
oh my fucking god
Me: "It's not like I have two audio sources on this thing... maybe if I minimize all my components"
I put the (int)rarity value to 1 and my scrap still spawns all the time
Removing the second audio source did not fix the audio doubling up glitch...
Well, I'm still compiling against v40 rip of the game. I guess it's time to make a new unity project.
is there any caching involved for spawning scraps?
weird
i have not had that issue personally
I think it's because I haven't done the patching, and I'm not sure how it works, how did u do yours?
decompiled ur LethalThings.Miscellaneous but it looks gibberish, idk how to read this
It’s monomod
Lmao
It’s so funny how completely foreign monomod is to this community
haven;t really modded before so everything here is new to me hahaha
well i found the part where I can clear my mod cache and it seems to have been fixed?
idk i will update u on the matter tho
@lofty nymph what an ordeal
So, I finally fixed my sound duplication glitch by re-bundling my item with the v45.2 rip of the game instead of v40 which I was still using before.
Now I can make stale hotdogs
This also implies that we have to re-rip the game every update to avoid these problems...
weird, i did not have the same issue when i build my mod against the previous update
by previous update do you mean v40 or v45 or v45.1
there's been two patches
since v45
a few of us have been calling the current v45.2 lol
v40
my mod didn't actually have any issues when the game updated
Is there any documentation for custom moon stuff yet?
is it normal that custom items might not save with your game save / disappear from the ship
uhh that shouldn't happen
unless your mods change or something
yea I am developing my mod atm so I'm recompiling the dll often
Is there a good document or guide for how to add a scrap item with LethalLib for someone who is new to modding?
Hope you dont mind me asking this dumb question, I was following the part "You'll want to Ctrl+D duplicate one of those to use for your own item, edit it, and link it in that script." But is it normal for it to say No MonoBehavior scripts in the file ?
weird, I never got such a warning
did you use evaisa's unity template or project cleaner?
I am using evaisa's unity template
Ah nevermind found the root cause was due to the public class name 
btw @lofty nymph do you know how to spawn a new scrap item into the map
I think that this will make a GameObject, but it's supposed to be a GrabbableObject, so I don't think this is correct...
public static void SpawnBreadAtLocation(Vector3 spawnPos)
{
GameObject StaleBreadObject = Object.Instantiate<GameObject>(StaleBreadItem.spawnPrefab);
StaleBreadObject.transform.localPosition = Vector3.zero;
StaleBreadObject.transform.localRotation = Quaternion.identity;
StaleBreadObject.transform.localScale = Vector3.one;
DropGrabbableObjectAtPosition(StaleBreadObject, spawnPos);
}```
wdym exactly?
just spawning it at a given position?
yea
DropGrabbableObjectAtPosition(StaleBreadObject, spawnPos); is a function I put together from disassembly that just does the same thing as a player dropping an existing object btw
but at that position
so I just need to spawn it
GameObject StaleBreadObject = Object.Instantiate<GameObject>(StaleBreadItem.spawnPrefab);
StaleBreadObject.GetComponent<NetworkObject>().Spawn();
this is all you need to spawn a object
ooo
tho you will have to do stuff like setting the scrap value
because just spawning the prefab does not do that for you
check out RoundManager.SpawnScrapInLevel() ig
hmm, I got an error with that
one that makes no sense to me, because I declared that as a GameObject rather than void
maybe this will work
try starting the variable with a lowercase
staleBreadObject
oh
nvm
why are you trying to assign it
to a variable
lmao
so I can do stuff to it
if I don't have the GrabbableObject how would I teleport it?
yeah that looks more correct
oh right
tho you might need a network transform on the prefab
I need to set the rarity and stuff
not sure about that
oh
lmfao
it WAS working
it was just spawning the bread underneath the teleporter
ah ... now one spawned invisible
also I didn't need to spawn a network object I guess, the game gave me an error saying it was already spawned
I think I know why it's invisible
nope
So, I'm getting invisible bread to spawn now. You can scan it and get the green popup thing, but it's invisible.
But if I close my game and rejoin the save, the bread is there then.
edit:
Welp, after a few hours I still haven't gotten it.
I am trying to sync it with this function too just as the game does.
SyncScrapValuesClientRpc
Gonna take a break for now
check the object in the explorer to see if the meshes are disabled or something @foggy forge
i know that switching items will disable the meshes so if its in someone's inventory, but not hands, and you force them to drop it then it will still have its meshes disabled and be invisible
if I have my custom scrap in my hands and I pick up an other item it duplicate and then can't drop or switch to anything els?
hmm, the mesh renderer is enabled, other stuff is enabled
Idk what it is
oh. shader issue maybe?
Does the bread parent itself to the Ship, or just outside of it?
My custom scrap doesnt spawn and when i instantiate it, it appears like this and it also says in the logs that there is a null reference but i have all the required compoenents
can you show me the error
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
GrabbableObject.Update () (at <44743d9474784365a095189c76175301>:IL_0117)
is there an implemented way to make Decor appear in the terminal shop "daily rotation" listing rn
uhh it should already be doing that if you register it as a decor item
as long as the alwaysInStock property is false
Seems like you did not assign the itemProperties field of your prefab
this did not have to be implemented in the lib directly since the game handles that list
which reminds me, i had alwaysInStock set to true for my lethal things decor so they were never showing up lmao
not unless it is a ship upgrade
in which case it'll go in a different list
now it doesnt give error but still does the same thing
i think i will simply solve this by making it a ship upgrade
since i don't know if "permanently available decor" is meant to be a thing
not in vanilla
what components does a custom scrap need?
Rip the game and find out :3
Because it depends
Ah you figured that out cool
I added my custom scrap to the game I can hold it and scan it but when I switch to another item my custom scrap when invisible does anyone know why it does that ?
Hey is there any place I can look at LethalThings source? Wanted to reference some stuff on how LethalLib is used in it. If there's no plans to do that that's fine as well
its on thunderstore
Ah
its not a github link
thank youu
Eba does lethal lib have utils for creating ship objects?
yeah
that's what i use for the decor items in lethal things
Is there a guide to LethalLib anywhere?
I still haven't really had time to write documentation, and i am not sure if anyone else has written any
I think there's a bug with invite friends problem in this mod
My HUD become this big and uncontrollable
But sometimes it working...
I finally got back to it after taking a break from working on the bread.
WaitForScrapToSpawnToSync() called by SpawnScrapInLevel() is indeed necessary to sync the scrap's value for all players.
The game originally waits 11 seconds to set that number... but there is no reason to. I set mines to set it after 1 second.
Aside from that, I just copied the spawn code a second time from the game and now it's just working...
This is just a bepinex console problem
disabling the console should fix it
is it normal for items from lethallib to not save
Uhh mine do
Thats odd
Oh its fine now I figured out what I was doing wrong
had some logic in my code that set itemUsedUp to true every update frame
https://thunderstore.io/c/lethal-company/p/Evaisa/LethalLib/
CC: @devout glacier
Not sure if this has been suggested but have you thought about setting the GlobalObjectIdHash when you add them to network prefabs because this caused me some issue trying to spawn new NetworkObjects
uhh when is this a problem exactly? i have not ran into this
I spawn custom network objects all the time
pretty sure NGO takes care of this for you
Register 2 prefabs and I get an error
Saying that you can’t register it because the GlobalObjectIdHash is 0
Which is used by the first prefab you register
huh. i never had this issue
GlobalObjectIdHash is generated by the editor
every time a NetworkObject component is added to an object
so every prefab in my assetbundle has a unique one
Wait what lol
wait are you making your prefabs at runtime or something?
NGO 1.5.2 is what i use
go debug mod
It is debug mode
yours shows a bunch of properties i don't see lol
package manager
Yeah
lfg thank you eva
I'll not update and tell you if my stuff breaks 👍
after implementation I can confirm that enemies and dungeons work fine with this new system, but items for some reason don't (seem to?) get added to the level's spawnable scrap list
NBD for my purposes since I can just uncomment the code that adds them manually, but still worth noting
uhh
how are you adding it?
are you using the string override
or the All enum
because i confirmed it works with the enum
haven't tested the override, just assumed it worked because the code is pretty straightforward
gimme a sec
can you test what happens when you use the All enum
if that works fine i am really confused
var alwaysValid = scrapItem.spawnLevels.HasFlag(Levels.LevelTypes.All) || (scrapItem.spawnLevelOverrides != null && scrapItem.spawnLevelOverrides.Any(item => item.ToLowerInvariant() == name.ToLowerInvariant()));
this is the override rn
setting it to All worked fine and the scrap did indeed spawn inside
hmmm..
so something is wrong with the string list override
Oh
i see the problem
wait no nvm
this constructor doesn't set spawnLevelOverrides?
I was also looking at the flag for ages wondering where it went wrong I dont blame you
I'll push that fix in a bit, i'm working on a fix for item saving right now
ok this is really dumb but how do i use the library in visual studio?
trying to get back into coding again
you click add project reference and select the dll of the library
thank you <3
where can i find the documentation for it? Like how to use it
I haven't written any yet, what exactly do you want to make?
@solar blaze said they have a tutorial for custom scrap (?
scrap and other items are pretty similar in implementation if you just want to add items
as for other stuff, i do not personally know of any resources
#modding-general message
Make sure you set up the unity project (linked two messages down)
im mostly looking for a easy way to change in game mechanics. i can pm you my idea but i dont want anyone else to do it yet cuz i wont have any motivation to get back into programming again and its for the modjam xd
like make it possible to tame lootbugs so they take loot back to the ship for you is one idea i had thats a good example.
thats actually such a good idea, i wanna make a mod for it now
yo i was testing the API and made a basic template for scrap items using the API but i would like to know to what exactly it makes reference has the "AssetsBundle" and i mean what does the file has to contain for the program to be able to read it, i already tested using another guy scrap mode and it funks using my own template for the mod, but i want to create my costum scrap but im not sure how to start
i know C# but 0 about Unity sadly
@eternal sphinx honestly just imagine assetbundles as an organised zip that stops you from putting a few things inside of it
Unity lets you build them by assigning specific assetbundle "tag"s onto assets you have in editor, and then it also smartly finds everything those tagged assets reference and bundles those up to
thats the template, and thats the file it references into
but im not completly sure how to do my own one and make it funk
so like i could tag my custom moon prefab as the "moremoons" assetbundle and when i try and build that itll see everything the prefab has inside it and build that too
assetbundles can be a little tricky to learn because nowadays unity actually replaced it with a newer system called Adressables
An AssetBundle is content that is stored separately from a main game or application and loaded (or downloaded, in the case of mobile and online apps) at runtime. This helps minimize the impact on network and system resources by allowing customers to download and install only the parts they need. AssetBundles can also be used to update or add to ...
it is like a Json? seems like
i think its like a json + a zip
unity builds a little manifest for you included in the "zip" that has all the information
i want to think that the exact thing that imports all the model visual/special things its the AssetBundle that its being referenced too
like this
I would install this offical package to help visualise https://github.com/Unity-Technologies/AssetBundles-Browser