diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 82 |
1 files changed, 82 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 9474bab..942e4ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1127,7 +1127,89 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1127 | return 0.0f; | 1127 | return 0.0f; |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | // Routines for creating and managing parcels programmatically | ||
1131 | public void osParcelJoin(LSL_Vector pos1, LSL_Vector pos2) | ||
1132 | { | ||
1133 | CheckThreatLevel(ThreatLevel.High, "osParcelJoin"); | ||
1134 | m_host.AddScriptLPS(1); | ||
1135 | |||
1136 | int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); | ||
1137 | int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); | ||
1138 | int endx = (int)(pos1.x > pos2.x ? pos1.x : pos2.x); | ||
1139 | int endy = (int)(pos1.y > pos2.y ? pos1.y : pos2.y); | ||
1140 | |||
1141 | World.LandChannel.Join(startx,starty,endx,endy,m_host.OwnerID); | ||
1142 | } | ||
1143 | |||
1144 | public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) | ||
1145 | { | ||
1146 | CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide"); | ||
1147 | m_host.AddScriptLPS(1); | ||
1148 | |||
1149 | int startx = (int)(pos1.x < pos2.x ? pos1.x : pos2.x); | ||
1150 | int starty = (int)(pos1.y < pos2.y ? pos1.y : pos2.y); | ||
1151 | int endx = (int)(pos1.x > pos2.x ? pos1.x : pos2.x); | ||
1152 | int endy = (int)(pos1.y > pos2.y ? pos1.y : pos2.y); | ||
1130 | 1153 | ||
1154 | World.LandChannel.Subdivide(startx,starty,endx,endy,m_host.OwnerID); | ||
1155 | } | ||
1156 | |||
1157 | public void osParcelSetDetails(LSL_Vector pos, LSL_List rules) | ||
1158 | { | ||
1159 | CheckThreatLevel(ThreatLevel.High, "osParcelSetDetails"); | ||
1160 | m_host.AddScriptLPS(1); | ||
1161 | |||
1162 | // Get a reference to the land data and make sure the owner of the script | ||
1163 | // can modify it | ||
1164 | |||
1165 | ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y); | ||
1166 | if (startLandObject == null) | ||
1167 | { | ||
1168 | OSSLShoutError("There is no land at that location"); | ||
1169 | return; | ||
1170 | } | ||
1171 | |||
1172 | if (! World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject)) | ||
1173 | { | ||
1174 | OSSLShoutError("You do not have permission to modify the parcel"); | ||
1175 | return; | ||
1176 | } | ||
1177 | |||
1178 | // Create a new land data object we can modify | ||
1179 | LandData newLand = startLandObject.LandData.Copy(); | ||
1180 | UUID uuid; | ||
1181 | |||
1182 | // Process the rules, not sure what the impact would be of changing owner or group | ||
1183 | for (int idx = 0; idx < rules.Length; ) | ||
1184 | { | ||
1185 | int code = rules.GetLSLIntegerItem(idx++); | ||
1186 | string arg = rules.GetLSLStringItem(idx++); | ||
1187 | switch (code) | ||
1188 | { | ||
1189 | case 0: | ||
1190 | newLand.Name = arg; | ||
1191 | break; | ||
1192 | |||
1193 | case 1: | ||
1194 | newLand.Description = arg; | ||
1195 | break; | ||
1196 | |||
1197 | case 2: | ||
1198 | CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); | ||
1199 | if (UUID.TryParse(arg , out uuid)) | ||
1200 | newLand.OwnerID = uuid; | ||
1201 | break; | ||
1202 | |||
1203 | case 3: | ||
1204 | CheckThreatLevel(ThreatLevel.VeryHigh, "osParcelSetDetails"); | ||
1205 | if (UUID.TryParse(arg , out uuid)) | ||
1206 | newLand.GroupID = uuid; | ||
1207 | break; | ||
1208 | } | ||
1209 | } | ||
1210 | |||
1211 | World.LandChannel.UpdateLandObject(newLand.LocalID,newLand); | ||
1212 | } | ||
1131 | 1213 | ||
1132 | public double osList2Double(LSL_Types.list src, int index) | 1214 | public double osList2Double(LSL_Types.list src, int index) |
1133 | { | 1215 | { |