noisestudio Posted February 21, 2013 Share Posted February 21, 2013 (edited) want to know more about some function likeTheSim:FindFirstEntityWithTag("player")what is TheSim Class defination?what if i want a FindNextEntityWithTag functiondo i need to write it myself,or there is already one insidehow does don't stave search work?is everything in one table or in different tables.for example,all the rabbits in one table,all the butterfly in another,all the spider ect.say i have three science machine,if i build a fourth one,it will destroy the max distance machine,or the first builded one.how can i do that? Edited February 21, 2013 by noisestudio Link to comment Share on other sites More sharing options...
WrathOf Posted February 21, 2013 Share Posted February 21, 2013 (edited) So many technical questions! nom nom nom :DI highly doubt Klei would give us the game's documentation on class inheritance and data structures. They may be nice but not sure THAT nice. I dunno, as modders, we usually have to reverse engineer that kind of stuff.TheSIM is essentially the root...the source...Maxwell....whatever you want to call it....which is the exe portion that "runs" the game as the interpreter of all the lua script files. I don't believe you can inherit from it, just make calls to it's public methods to do low level things. You could do a search across the lua files for all the refs and get an idea of all the methods it offers based on usage.No idea how the search algorithm works to keep it efficient but it appears all data for a game in stored in the globlal "Ents" table with "sub-indexes" or whatever you call it for "groups" of information. Have not researched how the tagging system works though.If you look at the top of main.lua you will see a global to force saves to be uncompiled so you can get a sense of the data structure.Regarding keeping track of a specific prefab so you only have a certain number and older ones are deleted....I have not come across a mechanism for this since that is not a feature in the game. You would need to add this functionality to the prefab constructor and check against your own global that tracks that. Remember that you can make up your own table/matrix/etc data structure to store in this global. I might be wrong though, there might be some code somewhere....too much code to keep in mind at once :DIf we are lucky maybe one of the devs while provide us with more insight. Edited February 21, 2013 by WrathOf nom nom nom Link to comment Share on other sites More sharing options...
noisestudio Posted February 23, 2013 Author Share Posted February 23, 2013 (edited) thank you WrathOf,very helpful reply.have done what i want,rock and roll to another goal:biggrin-new: Edited February 23, 2013 by noisestudio 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