diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-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 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 | { |