- Timestamp:
- Aug 2, 2017, 6:46:15 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/AllocsCommands/Commands/RemoveLandProtection.cs
r266 r306 15 15 " 1. removelandprotection <steamid>\n" + 16 16 " 2. removelandprotection <x> <y> <z>\n" + 17 " 3. removelandprotection nearby [length]\n" + 17 18 "1. Remove all land claims owned by the user with the given SteamID\n" + 18 "2. Remove only the claim block on the exactly given block position"; 19 "2. Remove only the claim block on the exactly given block position\n" + 20 "3. Remove all claims in a square with edge length of 64 (or the optionally specified size) around the executing player"; 19 21 } 20 22 … … 95 97 { 96 98 try { 97 if (_params.Count == 1) { 99 if (_senderInfo.RemoteClientInfo != null) { 100 if (_params.Count >= 1 && _params [0].EqualsCaseInsensitive ("nearby")) { 101 _params.Add (_senderInfo.RemoteClientInfo.playerId); 102 } 103 } 104 105 if (_params.Count > 0 && _params [0].EqualsCaseInsensitive ("nearby")) { 106 try { 107 int closeToDistance = 32; 108 if (_params.Count == 3) { 109 if (!int.TryParse (_params[1], out closeToDistance)) { 110 SdtdConsole.Instance.Output ("Given length is not an integer!"); 111 return; 112 } 113 closeToDistance /= 2; 114 } 115 ClientInfo ci = ConsoleHelper.ParseParamSteamIdOnline (_params [_params.Count - 1]); 116 EntityPlayer ep = GameManager.Instance.World.Players.dict [ci.entityId]; 117 Vector3i closeTo = new Vector3i (ep.GetPosition ()); 118 LandClaimList.PositionFilter[] posFilters = new LandClaimList.PositionFilter[] { LandClaimList.CloseToFilter2dRect (closeTo, closeToDistance) }; 119 Dictionary<PersistentData.Player, List<Vector3i>> claims = LandClaimList.GetLandClaims (null, posFilters); 120 121 try { 122 List<BlockChangeInfo> changes = new List<BlockChangeInfo> (); 123 foreach (KeyValuePair<PersistentData.Player, List<Vector3i>> kvp in claims) { 124 foreach (Vector3i v in kvp.Value) { 125 BlockChangeInfo bci = new BlockChangeInfo (v, new BlockValue (0), true, false); 126 changes.Add (bci); 127 } 128 } 129 GameManager.Instance.SetBlocksRPC (changes); 130 } catch (Exception e) { 131 SdtdConsole.Instance.Output ("Error removing claims"); 132 Log.Out ("Error in RemoveLandProtection.Run: " + e); 133 return; 134 } 135 } catch (Exception e) { 136 SdtdConsole.Instance.Output ("Error getting current player's position"); 137 Log.Out ("Error in RemoveLandProtection.Run: " + e); 138 return; 139 } 140 } else if (_params.Count == 1) { 98 141 removeById (_params [0]); 99 142 } else if (_params.Count == 3) { 100 143 removeByPosition (_params); 101 144 } else { 102 SdtdConsole.Instance.Output (" Usage: removelandprotection <x> <y> <z> OR removelandprotection <steamid>");145 SdtdConsole.Instance.Output ("Illegal parameters"); 103 146 } 104 147 } catch (Exception e) {
Note:
See TracChangeset
for help on using the changeset viewer.