Scrap Mechanic

Scrap Mechanic

26 ratings
Inside farming / roof farming - placing soil elsewhere
By [IN-S] Cyllin
A short guide how to permit placing soil on roofs, inside prefab buildings, on metal, in the starter crashed ship, etc.!
   
Award
Favorite
Favorited
Unfavorite
What does this do?
You may be like me, that likes building on top of things. You know, piston-elevator and safely camp on top of a roof of an existing building. The survival mode has one major limitation in this: soil spots can only be placed on 'original' ground level areas. This prohibits planting inside, or on top of a (metal) roof, or... anywhere that's not the ground really.

I find this a bit limiting! I want to build a huge house on top of the workshop. It's a beautiful flat, large area. Why wouldn't I be able to grow crops there if I bring the soil myself?

This fix will allow you to place your soil in a lot more places, meaning rooftop farming becomes possible.
Want to make your starter farm on top of your spaceship? Sure.
Want to use the workshop roof as a nice farming area? Go ahead.
Want to build a huge farm on top of a warehouse? Why not.

Be warned: rooftop farming may inbalance the game because the Farmbots can't reach you.
How does this fix affect my game?
  • This fix will ONLY apply to your game. If you play multiplayer, other players that want to place soil elsewhere will each have to go through these steps.
  • This fix will allow you to place soil on 'forbidden' areas, including: generated structures like barns, your starting crashed spaceship, the workshop where you make craftbots, on the roof of virtually any building.
  • This fix DOES NOT allow you to place soil on player-made buildings or vehicles. While it is possible to enable this, it is buggy and does not result in plantable soil.
Applying the fix
How to:

1. Access your local folder of Scrap Mechanic. Usually:
C:\Program Files (x86)\Steam\steamapps\common\Scrap Mechanic\

2. Acces the following subfolder: Survival > Scripts > game > tools
\Survival\Scripts\game\tools

3. Back up the file "SoilBag.lua"! If anything goes wrong, you can use this to restore.

4. Open the file "SoilBag.lua" with Notepad or Notepad++

5. Look for the line (LINE 172)
if result.type == "terrainSurface" then

6. Replace with
if result.type == "terrainSurface" or result.type == "terrainAsset" then

7. Save the file, start the game.

8. You can now place soil on steel structures!
And now?
Enjoy your rooftop farm!
39 Comments
djpudz 11 Dec, 2024 @ 12:39am 
For this to work again, line 202 also needs changing from;
local valid, worldPos, worldNormal = ConstructionRayCast( { "terrainSurface" } )

To this;
local valid, worldPos, worldNormal = ConstructionRayCast( { "terrainSurface", "terrainAsset" } )

Works on the latest major update, 'Physics & Wedges'
MatMan818 14 Jun, 2023 @ 6:46am 
what code do you need to change on line 202
Kaz Von Zhuul 13 Apr, 2022 @ 5:45pm 
look on reddit to make it work also needs a change to line 202
vanflyhightanzek 8 Jul, 2021 @ 12:01am 
this does not work any more
Greasy Steel 26 Jun, 2021 @ 4:28pm 
do we have to use notepad
C2N14 1 Jan, 2021 @ 5:13pm 
i forgot you canbrowser files though steam but it stillwon't work
C2N14 1 Jan, 2021 @ 5:08pm 
i did this and it didn't work also i had find the file because when i check my scrap machic file every almost every file leads to an steam auto cloud also the thing you listed to get to the file aren't there for me
Vental 2 Dec, 2020 @ 12:15pm 
Yeah, it's not working at all for me.
Vental 30 Nov, 2020 @ 12:07pm 
It was instances like this on why I was curious about those other lines I mention earlier, specifically the line that mentions terrain a second time.
[IN-S] Cyllin  [author] 30 Nov, 2020 @ 8:02am 
I haven't tried the packing station and haven't been able to test it. Personally I've succesfully placed it on the workshop. Maybe the packing station has, like the towers, a different protection mechanic.