Maris Posted August 27, 2016 Share Posted August 27, 2016 (edited) I think it's possible... But how? Currently there are 4 tech trees in DST: SCIENCE, MAGIC, ANCIENT and SHADOW. I'd like to add one (or few) custom tech tree for custom crafting structure. I thought it's easy but it's not. I hope that I missed something... Edited August 28, 2016 by Maris Link to comment https://forums.kleientertainment.com/forums/topic/69813-solved-how-to-make-custom-tech-tree/ Share on other sites More sharing options...
rezecib Posted August 28, 2016 Share Posted August 28, 2016 (edited) @Maris Hm, I'm looking for all the places where they put Maxwell's SHADOW tree when they added it, maybe you missed one of these? constants, TECH.NONE.NEWTREE = 0, also TECH.NEWTREE_ONE, etc (these are optional, but get used in the recipes a lot) components/builder:EvaluateTechTrees makes specific mention to each of the trees in order to bring in self.bonus. Looks like it might involve a messy override in order to add intrinsic character bonuses to a tree, because it does both the check and the result without any functions in between to hook into... You could maybe do it by replacing self.accessible_tech_trees with a proxy table that has a metatable so you can intercept the assignment? That's pretty gross, though. components/builder_replica has Setters and Getters for each tree's intrinsic bonuses, these are called later in recipepopup KnowsRecipe explicitly checks each tree in both builder and builder_replica components/prototyper constructor, self.trees.NEWTREE = 0, and have any prototyper prefabs you make increase that prefabs/player_classified OnTechTreesDirty checks each of them explicitly. You could add a listener for "techtreesdirty" and make your check there. Also inst.newtreelevel would need to be added. recipe, self.level.NEWTREE = self.level.NEWTREE or 0 needs to be added, could be done by overriding Recipe._ctor, or doing an AddClassPostConstruct (maybe? the recipe.lua file doesn't return the class though, so maybe not) tuning, PROTOTYPER_TREES needs to have each of its entries modified (although I think if you don't they should default to zero from the other changes) widgets/recipepopup GetHintTextForRecipe takes into account player intrinsic bonuses to trees for the help text. This looks like it might need to be overridden Edited August 28, 2016 by rezecib Link to comment https://forums.kleientertainment.com/forums/topic/69813-solved-how-to-make-custom-tech-tree/#findComment-807750 Share on other sites More sharing options...
chromiumboy Posted August 28, 2016 Share Posted August 28, 2016 It's actually pretty straightforward IIRC local newtab = AddRecipeTab("Tab Name", *position on crafting menu (integer, 1 or more)*, "images/newtab.xml", "newtab.tex", *tag character must have in order to access the tab. Set to nil if you want everyone able to use it*) Then when you add your recipes, reference 'newtab' for the tab. E.g. AddRecipe("itemname", ingredients, newtab, etc) Link to comment https://forums.kleientertainment.com/forums/topic/69813-solved-how-to-make-custom-tech-tree/#findComment-807912 Share on other sites More sharing options...
rezecib Posted August 28, 2016 Share Posted August 28, 2016 @chromiumboy He's not adding a new recipe tab, he's adding a new tech tree. Like the way that there are items unlocked by various tiers of science, and items unlocked by various tiers of magic, etc. Link to comment https://forums.kleientertainment.com/forums/topic/69813-solved-how-to-make-custom-tech-tree/#findComment-807933 Share on other sites More sharing options...
Maris Posted August 28, 2016 Author Share Posted August 28, 2016 Thanks a lot! I think i did it! I made a lib for including in any mod. It's compatible to itself so the mods with the lib will be compatible to each other. How to use: modimport "custom_tech_tree.lua" AddNewTechTree("NEWTREE",2) --makes TECH.NEWTREE_ONE and TECH.NEWTREE_TWO http://pastebin.com/QjrbSzKE 15 hours ago, rezecib said: a proxy table that has a metatable There was an error (crash on class.lua line 24), so I did it the other way. I'm not sure if it's really possible to make a proxy on tables in a component. Anyway thanks! I used your comment as a TODO list. 1 Link to comment https://forums.kleientertainment.com/forums/topic/69813-solved-how-to-make-custom-tech-tree/#findComment-807950 Share on other sites More sharing options...
chromiumboy Posted August 29, 2016 Share Posted August 29, 2016 18 hours ago, rezecib said: @chromiumboy He's not adding a new recipe tab, he's adding a new tech tree. Like the way that there are items unlocked by various tiers of science, and items unlocked by various tiers of magic, etc. Oh, whoops, brain shortcircuited when I read references to Maxwells shadow magic XD Good to see that you guys seem to have sorted it out though Link to comment https://forums.kleientertainment.com/forums/topic/69813-solved-how-to-make-custom-tech-tree/#findComment-808217 Share on other sites More sharing options...
Zer000 Posted September 3, 2016 Share Posted September 3, 2016 On 28.08.2016 at 9:28 PM, Maris said: Thanks a lot! I think i did it! I made a lib for including in any mod. It's compatible to itself so the mods with the lib will be compatible to each other. How to use: modimport "custom_tech_tree.lua" AddNewTechTree("NEWTREE",2) --makes TECH.NEWTREE_ONE and TECH.NEWTREE_TWO http://pastebin.com/QjrbSzKE There was an error (crash on class.lua line 24), so I did it the other way. I'm not sure if it's really possible to make a proxy on tables in a component. Anyway thanks! I used your comment as a TODO list. Thx, everything works perfect) Link to comment https://forums.kleientertainment.com/forums/topic/69813-solved-how-to-make-custom-tech-tree/#findComment-810172 Share on other sites More sharing options...
kavaline Posted October 27, 2016 Share Posted October 27, 2016 (edited) What I need change for the character don't learn the recipe after prototype, like Maxwell with the book (or ancient's crafts, etc)? I want he can only craft around the custom tech machine @edit I find, it is in recipe: Recipe("name", {Ingredient("prefab", 2)}, RECIPETABS, TECH, nil, nil, true, nil, "tag") Set true if the character can't learn the recipe. Edited October 27, 2016 by kavaline Link to comment https://forums.kleientertainment.com/forums/topic/69813-solved-how-to-make-custom-tech-tree/#findComment-830118 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