@@ -197,10 +197,7 @@ Map = {
197
197
table.insert (Map .Chunk .data [dimid ][Tx ][Tz ],# Map .Chunk .data [dimid ][Tx ][Tz ]+ 1 ,landId )
198
198
end
199
199
elseif mode == ' del' then
200
- local p = Array .Fetch (Map .Chunk .data [dimid ][Tx ][Tz ],landId )
201
- if p ~=- 1 then
202
- table.remove (Map .Chunk .data [dimid ][Tx ][Tz ],p )
203
- end
200
+ Array .Remove (Map .Chunk .data [dimid ][Tx ][Tz ],landId )
204
201
end
205
202
end
206
203
end
@@ -268,16 +265,13 @@ Map = {
268
265
end
269
266
elseif mode == ' del' then
270
267
for x = spos .x ,epos .x do
271
- local tar = Map .Land .AXIS .data [dimid ][' x' ][x ]
272
- table.remove (tar ,Array .Fetch (tar ,landId ))
268
+ Array .Remove (Map .Land .AXIS .data [dimid ][' x' ][x ],landId )
273
269
end
274
270
for y = spos .y ,epos .y do
275
- local tar = Map .Land .AXIS .data [dimid ][' y' ][y ]
276
- table.remove (tar ,Array .Fetch (tar ,landId ))
271
+ Array .Remove (Map .Land .AXIS .data [dimid ][' y' ][y ],landId )
277
272
end
278
273
for z = spos .z ,epos .z do
279
- local tar = Map .Land .AXIS .data [dimid ][' z' ][z ]
280
- table.remove (tar ,Array .Fetch (tar ,landId ))
274
+ Array .Remove (Map .Land .AXIS .data [dimid ][' z' ][z ],landId )
281
275
end
282
276
end
283
277
end
@@ -446,15 +440,9 @@ Map = {
446
440
end
447
441
local landId = record .landId
448
442
if landId ~=- 1 then
449
- local pos = Array .Fetch (map .land_recorded_pos [landId ],strpos )
450
- if pos ~= - 1 then
451
- table.remove (map .land_recorded_pos [landId ],pos )
452
- end
443
+ Array .Remove (map .land_recorded_pos [landId ],strpos )
453
444
else
454
- local pos = Array .Fetch (map .non_land_pos ,strpos )
455
- if pos ~= - 1 then
456
- table.remove (map .non_land_pos ,pos )
457
- end
445
+ Array .Remove (map .non_land_pos ,strpos )
458
446
end
459
447
map .data [strpos ] = nil
460
448
end ,
@@ -509,10 +497,7 @@ Map = {
509
497
clear_range = function (cubestr ) -- clear single range's cache.
510
498
local map = Map .CachedQuery .RangeArea
511
499
for n ,landId in pairs (map .data [cubestr ].landlist ) do
512
- local pos = Array .Fetch (map .recorded_landId [landId ]," this." .. cubestr .. " .landlist.(*)" .. n )
513
- if pos ~=- 1 then
514
- table.remove (map .recorded_landId [landId ],pos )
515
- end
500
+ Array .Remove (map .recorded_landId [landId ]," this." .. cubestr .. " .landlist.(*)" .. n )
516
501
end
517
502
map .data [cubestr ] = nil
518
503
end ,
@@ -1985,6 +1970,9 @@ RangeSelector = {
1985
1970
if checkColl .status then
1986
1971
local sp = cfg .land .min_space
1987
1972
local nearbyLands = ILAPI .GetLandInRange (Pos .Add (posA ,sp ),Pos .Reduce (pos ,sp ),dimid )
1973
+ if MEM [xuid ].reselectLand ~= nil then
1974
+ Array .Remove (nearbyLands ,MEM [xuid ].reselectLand .id )
1975
+ end
1988
1976
if # nearbyLands ~= 0 then
1989
1977
SendText (player ,_Tr (' title.rangeselector.fail.space' ,' <a>' ,MakeShortILD (nearbyLands [1 ])))
1990
1978
else
@@ -2303,7 +2291,7 @@ end
2303
2291
function ILAPI .DeleteLand (landId )
2304
2292
local owner = ILAPI .GetOwner (landId )
2305
2293
if owner ~= ' ?' then
2306
- table.remove ( land_owners [ owner ], Array .Fetch (land_owners [owner ],landId ) )
2294
+ Array .Remove (land_owners [owner ],landId )
2307
2295
end
2308
2296
Map .CachedQuery .RangeArea .refresh (landId )
2309
2297
Map .CachedQuery .SinglePos .refresh (landId )
@@ -2546,15 +2534,15 @@ function ILAPI.AddTrust(landId,xuid)
2546
2534
end
2547
2535
function ILAPI .RemoveTrust (landId ,xuid )
2548
2536
local shareList = land_data [landId ].settings .share
2549
- table.remove ( shareList , Array .Fetch (shareList ,xuid ) )
2537
+ Array .Remove (shareList ,xuid )
2550
2538
Map .Land .Trusted .update (landId )
2551
2539
ILAPI .save ({0 ,1 ,0 })
2552
2540
return true
2553
2541
end
2554
2542
function ILAPI .SetOwner (landId ,xuid )
2555
2543
local ownerXuid = ILAPI .GetOwner (landId )
2556
2544
if ownerXuid ~= ' ?' then
2557
- table.remove ( land_owners [ ownerXuid ], Array .Fetch (land_owners [ownerXuid ],landId ) )
2545
+ Array .Remove (land_owners [ownerXuid ],landId )
2558
2546
end
2559
2547
table.insert (land_owners [xuid ],# land_owners [xuid ]+ 1 ,landId )
2560
2548
Map .Land .Owner .update (landId )
@@ -2671,9 +2659,9 @@ function ILAPI.SetRange(landId,newposA,newposB,newDimid)
2671
2659
land_data [landId ].range .end_position = {posB .x ,posB .y ,posB .z }
2672
2660
land_data [landId ].range .dimid = newDimid
2673
2661
land_data [landId ].settings .tpoint = {posA .x ,posA .y + 1 ,posA .z }
2662
+ Map .Land .Position .update (landId ,' add' )
2674
2663
Map .Land .Edge .update (landId ,' add' )
2675
2664
Map .Chunk .update (landId ,' add' )
2676
- Map .Land .Position .update (landId ,' add' )
2677
2665
Map .Land .AXIS .update (landId ,' add' )
2678
2666
Map .CachedQuery .RangeArea .refresh (landId )
2679
2667
Map .CachedQuery .SinglePos .refresh (landId )
@@ -2893,6 +2881,13 @@ Array = {
2893
2881
end
2894
2882
return origin
2895
2883
end ,
2884
+ Remove = function (array ,value )
2885
+ local pos = Array .Fetch (array ,value )
2886
+ if pos ~=- 1 then
2887
+ table.remove (array ,pos )
2888
+ end
2889
+ return array
2890
+ end ,
2896
2891
Reverse = function (tab )
2897
2892
local tmp_tab = table .clone (tab )
2898
2893
local rtn = {}
@@ -3669,7 +3664,7 @@ function RegisterCommands()
3669
3664
ERROR (_Tr (' console.landop.del.failbynull' ,' <a>' ,name ))
3670
3665
return
3671
3666
end
3672
- table.remove ( cfg . land . operator , Array .Fetch (cfg .land .operator ,xuid ) )
3667
+ Array .Remove (cfg .land .operator ,xuid )
3673
3668
Map .Land .Operator .update ()
3674
3669
ILAPI .save ({1 ,0 ,0 })
3675
3670
INFO (' System' ,_Tr (' console.landop.del.success' ,' <a>' ,name ,' <b>' ,xuid ))
0 commit comments