Berwin Posted December 3, 2018 Share Posted December 3, 2018 Hi I want to make Catcoon Dens created at world generation undestroyable which is already done but how do i make ones which are crafted act as default? This is the code I use in modmain.lua. AddPrefabPostInit("catcoonden", function(inst) inst:RemoveComponent("workable") inst:RemoveComponent("propagator") inst:RemoveComponent("burnable") inst:RemoveComponent("hauntable") end) Thanks Link to comment Share on other sites More sharing options...
Ultroman Posted December 3, 2018 Share Posted December 3, 2018 (edited) You can do a check in your AddPrefabPostInit to see whether the world time is higher than 0.1 or something, and differentiate between them like that. But you'll still run into problems when restarting the server, since you don't save its state about which "type" it is (whether it was generated or crafted). For that, you'd have to set a tag on the ones that are world generated (only do this is AddPrefabPostInit if world time is less than 0.1), and then also extend onsave and onload to save this variable, and set it again on load, and also make the same changes to the appropriate ones as you do in your AddPrefabPostInit. Edited December 3, 2018 by Ultroman Link to comment 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