Data Realms Fan Forums http://45.55.195.193/ |
|
Loop through all MOSRotatings? http://45.55.195.193/viewtopic.php?f=1&t=25181 |
Page 1 of 1 |
Author: | Awesomeness [ Tue Aug 16, 2011 4:07 am ] |
Post subject: | Loop through all MOSRotatings? |
How do you loop through all the MOSRotatings (well, anything with a sprite, like limbs, guns, grenades, etc.) on the map? Because I'd like to check if they're in a box and if so gib them. |
Author: | Awesomeness [ Thu Aug 18, 2011 4:21 am ] |
Post subject: | Re: Loop through all MOSRotatings? |
Found it myself. In the mission Citadel, the dart's Lua uses it. Code: for i = 1 , MovableMan:GetMOIDCount() - 2 do part = MovableMan:GetMOFromID(i); if part.ClassName ~= "MOPixel" then part = ToMovableObject(part); if part ~= nil then --Do stuff in here with it end end end Assuming self in this script is an MOSRotating that's pinned and can't collide with things, how do you check if the part is inside the boundaries of yourself? Oh, and is it possible to make an MOSRotating "On top"; as in it gets drawn after everything else it can? |
Author: | Grif [ Thu Aug 18, 2011 2:28 pm ] |
Post subject: | Re: Loop through all MOSRotatings? |
To check for location extremely simply, set up a Box. It's literally constructed just like that: self.box = Box(Vector(pointx,pointy),Vector(pointx,pointy)); Then, just do self.box:WithinBox(part) or whatever you need. Also, the draw order stacking is hardcoded, unfortunately. Craft are always above actors which are always above guns which are always above magazines which are always above loose particles. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |