Scrap Mechanic

Scrap Mechanic

View Stats:
Need help with some lua related stuff
Hey there,

im recently into modding scrap and modifing the source files to my liking. my latest change was the addition of a stage 2 sledgehammer with slight different visuals. I just copied everything that i needed to change from the default seldgehammer and gave it a new uuid. Everything is working except that i can drop it...

the main problem with that is normaly you cant throw the hammer in survival for obvious reasons. i tried many things to find the script which controls the dropping of items but it seems like that is not handled in lua for whatever reason. The earliest script call is when the dropped hammer hits the floor and turns into a pickupable item. But i want to deny the dropping all together.

one smaller problem is that the dropped visuals are buggy, it shows only the white glowing particle effect but not the hammer model which is strange to me because the model works fine while holding or in the preview.
(its not that big of a deal because i dont want the hammer to be dropped in the first place)


has anybody experience with that or modding scrap in general?

i dont understand the different implementation stages, why is so much scripted in lua and some critical things in cpp (i guess). seems like the developers wanted the game not to be modded but changed their mind later on..


anyways, i hope i can gather some information from you guys :)
< >
Showing 1-2 of 2 comments
I think developing a game is one thing & making it fully moddable is another. What SM currently has are some essential modding features that allows modders to easily add new content (using existing game rules or game mechanics). What you are trying to do is technically a new game feature/mechanic/behavior that doesn't exist in the game, and that currently isn't possible/supported (at least not as simple workshop mod).

From what I've seen, it's mostly tools for the editor (rotate/move/scale) and also the in-game tools (welder, connector tool, lift) that are scripted in lua.

I think what youre trying to do is quite a deep change as it changes the behavior of item dropping. Perhaps, you could treat a thrown sledgehammer as a projectile (like potatoes from the spud gun), and once it hits any object it can spawn itself as item on the ground instead? There must be a physics collision listener somewhere for this stuff. You can probably do that but its not gonna be a workshop compatible mod.

Perhaps you can also achieve this via lua, but SM lacks documentation that helps you figure out how, where and when any lua script is being executed. If the lua scripts are somewhere hardcoded/referenced inside the game code, tough luck.
so far the only real modding in this game is a trainer mod...... it allows early craft and unlimited items and game speed
< >
Showing 1-2 of 2 comments
Per page: 1530 50

Date Posted: Dec 16, 2021 @ 6:31am
Posts: 2