@@ -76,7 +76,9 @@ protected override void Unload()
7676 { "PlayerBuildingStats" , "{0} have placed {1}{2} barricades and {3}{4} structures, so in total {5}{6} buildings." } ,
7777 { "BuildingStats" , "{0} players have built {1} barricades and {2} structures, so in total {3} buildings." } ,
7878 { "PlayerNotFound" , "Player {0} not found." } ,
79- { "BuildingStatsOtherNoPermission" , "You don't have permission to check other player building stats." }
79+ { "BuildingStatsOtherNoPermission" , "You don't have permission to check other player building stats." } ,
80+ { "MaxBarricadeHeightRestriction" , "You can't build {0} because it's higher than max {1}m height above the ground." } ,
81+ { "MaxStructureHeightRestriction" , "You can't build {0} because it's higher than max {1}m height above the ground." }
8082 } ;
8183
8284 private void OnLevelLoaded ( int level )
@@ -177,6 +179,15 @@ private void OnDeployBarricadeRequested(Barricade barricade, ItemBarricadeAsset
177179 return ;
178180 }
179181
182+ float groundHeight = LevelGround . getHeight ( point ) ;
183+ float barricadeHeight = point . y - groundHeight ;
184+ if ( Configuration . Instance . EnableMaxBarricadeHeight && barricadeHeight > Configuration . Instance . MaxBarricadeHeight )
185+ {
186+ SendMessageToPlayer ( unturnedPlayer , "MaxBarricadeHeightRestriction" , asset . itemName , Configuration . Instance . MaxBarricadeHeight . ToString ( "N0" ) ) ;
187+ shouldAllow = false ;
188+ return ;
189+ }
190+
180191 decimal multiplier = GetPlayerBuildingsMultiplier ( unturnedPlayer ) ;
181192 PlayerBuildings playerBuildings = Database . GetPlayerBuildings ( owner ) ;
182193
@@ -263,6 +274,15 @@ private void OnDeployStructureRequested(Structure structure, ItemStructureAsset
263274 return ;
264275 }
265276
277+ float groundHeight = LevelGround . getHeight ( point ) ;
278+ float structureHeight = point . y - groundHeight ;
279+ if ( Configuration . Instance . EnableMaxStructureHeight && structureHeight > Configuration . Instance . MaxStructureHeight )
280+ {
281+ SendMessageToPlayer ( unturnedPlayer , "MaxStructureHeightRestriction" , asset . itemName , Configuration . Instance . MaxStructureHeight . ToString ( "N0" ) ) ;
282+ shouldAllow = false ;
283+ return ;
284+ }
285+
266286 decimal multiplier = GetPlayerBuildingsMultiplier ( unturnedPlayer ) ;
267287 PlayerBuildings playerBuildings = Database . GetPlayerBuildings ( owner ) ;
268288
0 commit comments