diff options
author | OpenSim Master | 2010-04-29 11:57:30 -0700 |
---|---|---|
committer | unknown | 2010-05-13 14:22:48 -0700 |
commit | 4c740e1717f8071d48e34c584728fddcf05afdb2 (patch) | |
tree | e7ccc7e53f0238169f2d6c96a1f6e91fefd8aa21 /OpenSim/Region/ScriptEngine/Shared | |
parent | Minor tweak in ProcessEntityUpdates (mostly just confirming the git push is w... (diff) | |
download | opensim-SC-4c740e1717f8071d48e34c584728fddcf05afdb2.zip opensim-SC-4c740e1717f8071d48e34c584728fddcf05afdb2.tar.gz opensim-SC-4c740e1717f8071d48e34c584728fddcf05afdb2.tar.bz2 opensim-SC-4c740e1717f8071d48e34c584728fddcf05afdb2.tar.xz |
Implements three new OSSL functions for parcel management: osParcelJoin joins parcels in an area, osParcelSubdivide splits parcels in an area, osParcelSetDetails sets parcel name, description, owner and group owner. Join and Subdivide methods in LandChannel are exposed.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
3 files changed, 101 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7e68cc7..15469db 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1129,7 +1129,89 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1129 | return 0.0f; | 1129 | return 0.0f; |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | // Routines for creating and managing parcels programmatically | ||
1133 | public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2) | ||
1134 | { | ||
1135 | CheckThreatLevel(ThreatLevel.High, "osParcelJoin"); | ||
1136 | m_host.AddScriptLPS(1); | ||
1137 | |||
1138 | int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); | ||
1139 | int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); | ||
1140 | int endx = (int)(pos1.x > pos2.x ? pos1.x : pos2.x); | ||
1141 | int endy = (int)(pos1.y > pos2.y ? pos1.y : pos2.y); | ||
1142 | |||
1143 | World.LandChannel.Join(startx,starty,endx,endy,m_host.OwnerID); | ||
1144 | } | ||
1145 | |||
1146 | public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) | ||
1147 | { | ||
1148 | CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide"); | ||
1149 | m_host.AddScriptLPS(1); | ||
1150 | |||
1151 | int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); | ||
1152 | int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); | ||
1153 | int endx = (int)(pos1.x > pos2.x ? pos1.x : pos2.x); | ||
1154 | int endy = (int)(pos1.y > pos2.y ? pos1.y : pos2.y); | ||
1132 | 1155 | ||
1156 | World.LandChannel.Subdivide(startx,starty,endx,endy,m_host.OwnerID); | ||
1157 | } | ||
1158 | |||
1159 | public void osParcelSetDetails(LSL_Vector pos, LSL_List rules) | ||
1160 | { | ||
1161 | CheckThreatLevel(ThreatLevel.High, "osParcelSetDetails"); | ||
1162 | m_host.AddScriptLPS(1); | ||
1163 | |||
1164 | // Get a reference to the land data and make sure the owner of the script | ||
1165 | // can modify it | ||
1166 | |||
1167 | ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y); | ||
1168 | if (startLandObject == null) | ||
1169 | { | ||
1170 | OSSLShoutError("There is no land at that location"); | ||
1171 | return; | ||
1172 | } | ||
1173 | |||
1174 | if (! World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject)) | ||
1175 | { | ||
1176 | OSSLShoutError("You do not have permission to modify the parcel"); | ||
1177 | return; | ||
1178 | } | ||
1179 | |||
1180 | // Create a new land data object we can modify | ||
1181 | LandData newLand = startLandObject.LandData.Copy(); | ||
1182 | UUID uuid; | ||
1183 | |||
1184 | // Process the rules, not sure what the impact would be of changing owner or group | ||
1185 | for (int idx = 0; idx < rules.Length; ) | ||
1186 | { | ||
1187 | int code = rules.GetLSLIntegerItem(idx++); | ||
1188 | string arg = rules.GetLSLStringItem(idx++); | ||
1189 | switch (code) | ||
1190 | { | ||
1191 | case 0: | ||
1192 | newLand.Name = arg; | ||
1193 | break; | ||
1194 | |||
1195 | case 1: | ||
1196 | newLand.Description = arg; | ||
1197 | break; | ||
1198 | |||
1199 | case 2: | ||
1200 | CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); | ||
1201 | if (UUID.TryParse(arg , out uuid)) | ||
1202 | newLand.OwnerID = uuid; | ||
1203 | break; | ||
1204 | |||
1205 | case 3: | ||
1206 | CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); | ||
1207 | if (UUID.TryParse(arg , out uuid)) | ||
1208 | newLand.GroupID = uuid; | ||
1209 | break; | ||
1210 | } | ||
1211 | } | ||
1212 | |||
1213 | World.LandChannel.UpdateLandObject(newLand.LocalID,newLand); | ||
1214 | } | ||
1133 | 1215 | ||
1134 | public double osList2Double(LSL_Types.list src, int index) | 1216 | public double osList2Double(LSL_Types.list src, int index) |
1135 | { | 1217 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 60b8050..7a8f469 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -123,6 +123,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
123 | void osWindParamSet(string plugin, string param, float value); | 123 | void osWindParamSet(string plugin, string param, float value); |
124 | float osWindParamGet(string plugin, string param); | 124 | float osWindParamGet(string plugin, string param); |
125 | 125 | ||
126 | // Parcel commands | ||
127 | void osParcelJoin(vector pos1, vector pos2); | ||
128 | void osParcelSubdivide(vector pos1, vector pos2); | ||
129 | void osParcelSetDetails(vector pos, LSL_List rules); | ||
126 | 130 | ||
127 | string osGetScriptEngineName(); | 131 | string osGetScriptEngineName(); |
128 | string osGetSimulatorVersion(); | 132 | string osGetSimulatorVersion(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 3870af3..fd9309a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -106,6 +106,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
106 | // return m_OSSL_Functions.osWindParamGet(plugin, param); | 106 | // return m_OSSL_Functions.osWindParamGet(plugin, param); |
107 | // } | 107 | // } |
108 | 108 | ||
109 | public void osParcelJoin(vector pos1, vector pos2) | ||
110 | { | ||
111 | m_OSSL_Functions.osParcelJoin(pos1,pos2); | ||
112 | } | ||
113 | |||
114 | public void osParcelSubdivide(vector pos1, vector pos2) | ||
115 | { | ||
116 | m_OSSL_Functions.osParcelSubdivide(pos1, pos2); | ||
117 | } | ||
118 | |||
119 | public void osParcelSetDetails(vector pos, LSL_List rules) | ||
120 | { | ||
121 | m_OSSL_Functions.osParcelSetDetails(pos,rules); | ||
122 | } | ||
123 | |||
109 | public double osList2Double(LSL_Types.list src, int index) | 124 | public double osList2Double(LSL_Types.list src, int index) |
110 | { | 125 | { |
111 | return m_OSSL_Functions.osList2Double(src, index); | 126 | return m_OSSL_Functions.osList2Double(src, index); |