diff options
author | Justin Clark-Casey (justincc) | 2014-02-27 00:11:50 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-02-27 00:11:50 +0000 |
commit | d7c9725ec03594df8b5657a500059c080923a7c5 (patch) | |
tree | bb73a57e54fcaa3e9509fc82aeaceb44a52b3bd1 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Add Util method to load OpSys env vars (diff) | |
download | opensim-SC-d7c9725ec03594df8b5657a500059c080923a7c5.zip opensim-SC-d7c9725ec03594df8b5657a500059c080923a7c5.tar.gz opensim-SC-d7c9725ec03594df8b5657a500059c080923a7c5.tar.bz2 opensim-SC-d7c9725ec03594df8b5657a500059c080923a7c5.tar.xz |
refactor: Make osGetPrimtiveParams() and soSetPrimitiveParams() use common get/set params code in LSL_Api rather than an old copy&pasted section.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 25d8c54..f126561 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7400,7 +7400,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7400 | { | 7400 | { |
7401 | m_host.AddScriptLPS(1); | 7401 | m_host.AddScriptLPS(1); |
7402 | 7402 | ||
7403 | setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams"); | 7403 | SetLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams"); |
7404 | 7404 | ||
7405 | ScriptSleep(200); | 7405 | ScriptSleep(200); |
7406 | } | 7406 | } |
@@ -7409,7 +7409,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7409 | { | 7409 | { |
7410 | m_host.AddScriptLPS(1); | 7410 | m_host.AddScriptLPS(1); |
7411 | 7411 | ||
7412 | setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams"); | 7412 | SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams"); |
7413 | 7413 | ||
7414 | ScriptSleep(200); | 7414 | ScriptSleep(200); |
7415 | } | 7415 | } |
@@ -7418,13 +7418,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7418 | { | 7418 | { |
7419 | m_host.AddScriptLPS(1); | 7419 | m_host.AddScriptLPS(1); |
7420 | 7420 | ||
7421 | setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); | 7421 | SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); |
7422 | } | 7422 | } |
7423 | 7423 | ||
7424 | protected void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) | 7424 | protected void SetLinkPrimParams(int linknumber, LSL_List rules, string originFunc) |
7425 | { | 7425 | { |
7426 | List<ISceneEntity> entities = GetLinkEntities(linknumber); | 7426 | SetEntityParams(GetLinkEntities(linknumber), rules, originFunc); |
7427 | } | ||
7427 | 7428 | ||
7429 | protected void SetEntityParams(List<ISceneEntity> entities, LSL_List rules, string originFunc) | ||
7430 | { | ||
7428 | LSL_List remaining = null; | 7431 | LSL_List remaining = null; |
7429 | uint rulesParsed = 0; | 7432 | uint rulesParsed = 0; |
7430 | 7433 | ||
@@ -7438,7 +7441,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7438 | 7441 | ||
7439 | while (remaining != null && remaining.Length > 2) | 7442 | while (remaining != null && remaining.Length > 2) |
7440 | { | 7443 | { |
7441 | linknumber = remaining.GetLSLIntegerItem(0); | 7444 | int linknumber = remaining.GetLSLIntegerItem(0); |
7442 | rules = remaining.GetSublist(1, -1); | 7445 | rules = remaining.GetSublist(1, -1); |
7443 | entities = GetLinkEntities(linknumber); | 7446 | entities = GetLinkEntities(linknumber); |
7444 | 7447 | ||
@@ -11530,41 +11533,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11530 | if (obj.OwnerID != m_host.OwnerID) | 11533 | if (obj.OwnerID != m_host.OwnerID) |
11531 | return; | 11534 | return; |
11532 | 11535 | ||
11533 | uint rulesParsed = 0; | 11536 | SetEntityParams(new List<ISceneEntity>() { obj }, rules, originFunc); |
11534 | LSL_List remaining = SetPrimParams(obj, rules, originFunc, ref rulesParsed); | ||
11535 | |||
11536 | while ((object)remaining != null && remaining.Length > 2) | ||
11537 | { | ||
11538 | LSL_Integer newLink = remaining.GetLSLIntegerItem(0); | ||
11539 | LSL_List newrules = remaining.GetSublist(1, -1); | ||
11540 | foreach(SceneObjectPart part in GetLinkParts(obj, newLink)){ | ||
11541 | remaining = SetPrimParams(part, newrules, originFunc, ref rulesParsed); | ||
11542 | } | ||
11543 | } | ||
11544 | } | 11537 | } |
11545 | 11538 | ||
11546 | public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) | 11539 | public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) |
11547 | { | 11540 | { |
11548 | SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); | 11541 | SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); |
11549 | 11542 | ||
11550 | LSL_List result = new LSL_List(); | ||
11551 | |||
11552 | if (obj != null && obj.OwnerID == m_host.OwnerID) | 11543 | if (obj != null && obj.OwnerID == m_host.OwnerID) |
11553 | { | 11544 | return GetEntityParams(obj, rules); |
11554 | LSL_List remaining = GetPrimParams(obj, rules, ref result); | ||
11555 | |||
11556 | while (remaining != null && remaining.Length > 2) | ||
11557 | { | ||
11558 | int linknumber = remaining.GetLSLIntegerItem(0); | ||
11559 | rules = remaining.GetSublist(1, -1); | ||
11560 | List<SceneObjectPart> parts = GetLinkParts(linknumber); | ||
11561 | 11545 | ||
11562 | foreach (SceneObjectPart part in parts) | 11546 | return new LSL_List(); |
11563 | remaining = GetPrimParams(part, rules, ref result); | ||
11564 | } | ||
11565 | } | ||
11566 | |||
11567 | return result; | ||
11568 | } | 11547 | } |
11569 | 11548 | ||
11570 | public void print(string str) | 11549 | public void print(string str) |