View unanswered posts | View active topics It is currently Thu Dec 26, 2024 5:31 pm



Reply to topic  [ 8 posts ] 
 Accessing Terrain MOPs? 
Author Message
User avatar

Joined: Fri Oct 17, 2008 9:46 pm
Posts: 5212
Location: The Grills Locker.
Reply with quote
Post 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?


Sun Aug 08, 2010 4:41 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Accessing Terrain MOPs?
SceneMan:GetTerrMatter(whatevertheargumentsare)

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


Sun Aug 08, 2010 6:29 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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".


Sun Aug 08, 2010 7:53 pm
Profile
User avatar

Joined: Fri Oct 17, 2008 9:46 pm
Posts: 5212
Location: The Grills Locker.
Reply with quote
Post 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.


Sun Aug 08, 2010 8:46 pm
Profile WWW
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Accessing Terrain MOPs?
MOPixels are only moving particles. Terrain is indeed a different thing, and outside of any kind of MovableObject.


Sun Aug 08, 2010 10:09 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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"


Sun Aug 08, 2010 10:41 pm
Profile
User avatar

Joined: Sat Jun 19, 2010 5:02 pm
Posts: 331
Location: Mekkan
Reply with quote
Post Re: Accessing Terrain MOPs?
Is there an easy way of raping the terrain at whatever coordinates or in a box or something? Just curious.


Thu Aug 19, 2010 7:14 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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.


Thu Aug 19, 2010 7:25 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.149s | 13 Queries | GZIP : Off ]