Data Realms Fan Forums
http://45.55.195.193/

Accessing Terrain MOPs?
http://45.55.195.193/viewtopic.php?f=73&t=19462
Page 1 of 1

Author:  Areku [ Sun Aug 08, 2010 4:41 pm ]
Post subject:  Accessing Terrain MOPs?

So, I'm making a force-based digger, and wanted to know if there's any way to access the terrain MOPixels, so I can dislodge them via Lua. Does anyone know of such a method?

Author:  Grif [ Sun Aug 08, 2010 6:29 pm ]
Post subject:  Re: Accessing Terrain MOPs?

SceneMan:GetTerrMatter(whatevertheargumentsare)

is probably your best bet, but it's a pretty expensive function

Author:  CaveCricket48 [ Sun Aug 08, 2010 7:53 pm ]
Post subject:  Re: Accessing Terrain MOPs?

Also, you can check if a MOPixel is a dislodged terrain particle by checking its PresetName, since all dislodged terrain particles have the PresetName "none".

Author:  Areku [ Sun Aug 08, 2010 8:46 pm ]
Post subject:  Re: Accessing Terrain MOPs?

But, if I remember correctly, that function only returns the material that the terrain is made of, and not a pointer to a specific terrain MOP. Actually, now that I think of it, isn't terrain outside of MovableMan's scope? If so, I doubt that there's a way of reaching a specific terrain area via scripts. But hey, I dunno, so that's why I'm asking.

The thing about PresetNames was a pretty nifty hint, though, CaveCricket.

Author:  TheLastBanana [ Sun Aug 08, 2010 10:09 pm ]
Post subject:  Re: Accessing Terrain MOPs?

MOPixels are only moving particles. Terrain is indeed a different thing, and outside of any kind of MovableObject.

Author:  Grif [ Sun Aug 08, 2010 10:41 pm ]
Post subject:  Re: Accessing Terrain MOPs?

We have basically no control over settled anything, thanks to it being held under whatever umbrella Data defines as "terrain management"

Author:  Awesomeness [ Thu Aug 19, 2010 7:14 pm ]
Post subject:  Re: Accessing Terrain MOPs?

Is there an easy way of raping the terrain at whatever coordinates or in a box or something? Just curious.

Author:  TheLastBanana [ Thu Aug 19, 2010 7:25 pm ]
Post subject:  Re: Accessing Terrain MOPs?

The one way to do it easiest is to make on MOSRotating shaped like the hole you want to create, spawn it at the desired position, call EraseFromTerrain on it, then delete it. The only real problems with this are that you have to define the hole's shape before the game is loaded, and MOSRs will stop cutting terrain after a certain size (I think it's 96x96), so you have to make multiple MOSRs and assemble them together.
Another way, which is much more expensive and complicated, but allows for shapes to be defined at runtime, is to make a two-dimensional array of coordinates and iterate through it in chunks every frame, erasing an 1x1 MOSR from every position. That's how the eraser tool from my computer brain mod works, but it's pretty inefficient and it took quite a while to optimize the code enough to be functional. It works for small patches, but definitely not big pieces.
Keep in mind that neither of these actually detach pieces of the dirt like a digger would. They just erase pixels. If you want something like a digger, your best bet is firing invisible, sharp, high-mass particles at the terrain. It won't be very accurate, however.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/