diff options
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics')
-rwxr-xr-x | OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index 6009dc5..0cbc5f9 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | |||
@@ -31,10 +31,10 @@ using System.Reflection; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | 32 | ||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.CoreModules; | ||
34 | using OpenSim.Region.Framework; | 35 | using OpenSim.Region.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Region.CoreModules; | ||
38 | 38 | ||
39 | using Mono.Addins; | 39 | using Mono.Addins; |
40 | using Nini.Config; | 40 | using Nini.Config; |
@@ -49,6 +49,10 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | private static string LogHeader = "[EXTENDED PHYSICS]"; | 50 | private static string LogHeader = "[EXTENDED PHYSICS]"; |
51 | 51 | ||
52 | // Since BulletSim is a plugin, this these values aren't defined easily in one place. | ||
53 | // This table must coorespond to an identical table in BSScene. | ||
54 | public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; | ||
55 | |||
52 | private IConfig Configuration { get; set; } | 56 | private IConfig Configuration { get; set; } |
53 | private bool Enabled { get; set; } | 57 | private bool Enabled { get; set; } |
54 | private Scene BaseScene { get; set; } | 58 | private Scene BaseScene { get; set; } |
@@ -143,13 +147,6 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
143 | [ScriptConstant] | 147 | [ScriptConstant] |
144 | public static int PHYS_CENTER_OF_MASS = 1 << 0; | 148 | public static int PHYS_CENTER_OF_MASS = 1 << 0; |
145 | 149 | ||
146 | [ScriptConstant] | ||
147 | public static int PHYS_LINKSET_TYPE_CONSTRAINT = 1; | ||
148 | [ScriptConstant] | ||
149 | public static int PHYS_LINKSET_TYPE_COMPOUND = 2; | ||
150 | [ScriptConstant] | ||
151 | public static int PHYS_LINKSET_TYPE_MANUAL = 3; | ||
152 | |||
153 | [ScriptInvocation] | 150 | [ScriptInvocation] |
154 | public string physGetEngineType(UUID hostID, UUID scriptID) | 151 | public string physGetEngineType(UUID hostID, UUID scriptID) |
155 | { | 152 | { |
@@ -163,9 +160,50 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
163 | return ret; | 160 | return ret; |
164 | } | 161 | } |
165 | 162 | ||
163 | [ScriptConstant] | ||
164 | public static int PHYS_LINKSET_TYPE_CONSTRAINT = 0; | ||
165 | [ScriptConstant] | ||
166 | public static int PHYS_LINKSET_TYPE_COMPOUND = 1; | ||
167 | [ScriptConstant] | ||
168 | public static int PHYS_LINKSET_TYPE_MANUAL = 2; | ||
169 | |||
166 | [ScriptInvocation] | 170 | [ScriptInvocation] |
167 | public void physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) | 171 | public void physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) |
168 | { | 172 | { |
173 | if (!Enabled) return; | ||
174 | |||
175 | // The part that is requesting the change. | ||
176 | SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); | ||
177 | |||
178 | if (requestingPart != null) | ||
179 | { | ||
180 | // The change is always made to the root of a linkset. | ||
181 | SceneObjectGroup containingGroup = requestingPart.ParentGroup; | ||
182 | SceneObjectPart rootPart = containingGroup.RootPart; | ||
183 | |||
184 | if (rootPart != null) | ||
185 | { | ||
186 | Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; | ||
187 | if (rootPhysActor != null) | ||
188 | { | ||
189 | rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType); | ||
190 | } | ||
191 | else | ||
192 | { | ||
193 | m_log.WarnFormat("{0} physSetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}", | ||
194 | LogHeader, rootPart.Name, hostID); | ||
195 | } | ||
196 | } | ||
197 | else | ||
198 | { | ||
199 | m_log.WarnFormat("{0} physSetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}", | ||
200 | LogHeader, requestingPart.Name, hostID); | ||
201 | } | ||
202 | } | ||
203 | else | ||
204 | { | ||
205 | m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); | ||
206 | } | ||
169 | } | 207 | } |
170 | } | 208 | } |
171 | } | 209 | } |