Nymall Posted May 17, 2014 Share Posted May 17, 2014 Hey guys, I'm hoping there's a quick fix to this problem. Right now I'm making a mod that uses getModData to store a "charge", and access this tile from other blocks("consumers"). There's also some other mod data i'd like to reference as well. I'm having some trouble referencing the tile or object that I want to store the charges. There's two ways I could think of doing it: 1.)Referencing the tile the object that stores the charges is on by X and Y coords. Problem is I'm not quite sure how to pull that data from a tile.2.)Referencing the instance of the "charger" item in question using it's index and storing it as mod data on the consumer. The only thing I'm afraid of is that the reference would be lost on Save/load, and recouping up the network might be a pain after every load. So, to summarize: What would be the best way to locate a instance of a item, fixture or tile?Could a item be targeted in Lua using just the raw XY coords?I'm also looking for a way to store "network" data. An ideal would allow each unique network to store an amount of power and have that be stored in one place(say on the player using getModData or some kind of fake item that spawns off map when a new network is created). What would be the best way of doing this?Thanks! Link to comment Share on other sites More sharing options...
turbotutone Posted May 17, 2014 Share Posted May 17, 2014 What would be the best way to locate a instance of a item, fixture or tile?you can iterate over the list of objects on a tileCould a item be targeted in Lua using just the raw XY coords?yes, assuming by item you mean object in the world, then by locating the gridsquare (tile) via XY and doing the above. take a look on this page:http://theindiestone.com/forums/index.php/topic/8249-tutorial-world-objects/ its covers some basics on how to do stuff like that.I'm also looking for a way to store "network" data. An ideal would allow each unique network to store an amount of power and have that be stored in one place(say on the player using getModData or some kind of fake item that spawns off map when a new network is created). What would be the best way of doing this?i think you could draw inspiration on how RJ has done the farming in vanilla, works mp/sp, he uses gameTime moddata as a sort of global data depot, as do many other mods. Afaik theres no real global data class or something (yet). goodluck and if anything unclear shoot! Link to comment Share on other sites More sharing options...
Nymall Posted May 17, 2014 Author Share Posted May 17, 2014 Awesome! Thank you! 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