Asiru Posted October 1, 2021 Share Posted October 1, 2021 Hello! I ran into a unique scenario while making my mod, and I haven't found a reply to this topic yet (but I linked a similar topic below). It just seems that there is no well-defined behavior for a placer recipe with "nounlock" set to true. As the topic below says, you can craft a structure at a prototyper but cannot place it down anywhere. I think the preferred behavior here would be that the placer would be invalid (turn red) anywhere outside the crafting radius of the prototyper. What I'm trying to achieve with my mod is a structure that the player can build, but is also required to be carried as a heavy object to the correct location (like the marble pieces). However, I don't want it to be a normal heavy object they can pick up and move at any time. I can think of doing this a couple ways: I'd like to place a heavy object as a structure from the torso equip slot, like a wall or pine cone. Right now this doesn't work because any interaction with a heavy object in the torso slot just drops the object at the player's feet. I'd like to carry a heavy object that is also a prototyper, which contains the structure recipe with "nounlock" set to true. Right now this doesn't work because you can't use a placer for "nounlock" recipes. If anyone can think of a workaround to this, please let me know! As it stands, it looks like this part of my mod will just have to be ignored for now. Link to comment https://forums.kleientertainment.com/forums/topic/134115-placer-recipes-with-nounlock/ Share on other sites More sharing options...
Monti18 Posted October 1, 2021 Share Posted October 1, 2021 If you want to be able to only build your structure at the prototyper, you can try something like this: --structure prefab local function OnBuilt(inst,player) if player and player.components.builder then for k,v in ipairs(player.components.builder.recipes) do if v == "your_prefab_name" then table.remove(player.components.builder.recipes,k) player.replica.builder:RemoveRecipe(v) break end end end end --fn of structure prefab inst:ListenForEvent("onbuilt",OnBuilt) You will need to remove the nounlock, but then as soon as you build the structure, the player that built it will forget the recipe (at least it should be like that, not tested ) But the problem then is that you can just make the structure at your heavy object and then leave without taking it with you... I think you could remedy this problem by adding a testfn to your recipe where you check if you are within a certain radius of your prototyper. To make your 1. working, you could make your own action for it that adds a deploy option if you have it laying on the ground so that it deploys at this point. Link to comment https://forums.kleientertainment.com/forums/topic/134115-placer-recipes-with-nounlock/#findComment-1500647 Share on other sites More sharing options...
Asiru Posted October 1, 2021 Author Share Posted October 1, 2021 29 minutes ago, Monti18 said: If you want to be able to only build your structure at the prototyper, you can try something like this: --structure prefab local function OnBuilt(inst,player) if player and player.components.builder then for k,v in ipairs(player.components.builder.recipes) do if v == "your_prefab_name" then table.remove(player.components.builder.recipes,k) player.replica.builder:RemoveRecipe(v) break end end end end --fn of structure prefab inst:ListenForEvent("onbuilt",OnBuilt) You will need to remove the nounlock, but then as soon as you build the structure, the player that built it will forget the recipe (at least it should be like that, not tested ) But the problem then is that you can just make the structure at your heavy object and then leave without taking it with you... I think you could remedy this problem by adding a testfn to your recipe where you check if you are within a certain radius of your prototyper. To make your 1. working, you could make your own action for it that adds a deploy option if you have it laying on the ground so that it deploys at this point. Thanks for the suggestion! This idea is interesting. Another possible solution I thought of is creating a custom action that lets a player click on a point on the ground to deploy the structure, but only when they are carrying the heavy object. The downside to that is I don't think I'll be able to use a placer in that case, and the player will just have to imagine where it gets deployed. :P Link to comment https://forums.kleientertainment.com/forums/topic/134115-placer-recipes-with-nounlock/#findComment-1500652 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now