Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Script.Load("../ns2/lua/NS2Utility.lua")
- local kSentryBuildRadius = 21 //WARNING: don't set to large because it will limit sentry building in adjacent rooms.
- local kMaxSentryInArea = 4
- local base_CheckBuildEntityRequirements //if you're a server admin you can just have "local base_CheckBuildEntityRequirements = CheckBuildEntityRequirements"
- if not base_CheckBuildEntityRequirements then //This if statement is to prevent a issue with code reloads that only occurs when modders save changes to this file while ns2 is running.
- base_CheckBuildEntityRequirements = CheckBuildEntityRequirements
- end
- local sentryClassName = "Sentry"
- local sentryErrorMessage = "Warning: Too many Sentries!"
- local _GetEntitiesWithinRange = GetEntitiesWithinRange
- local _Count = table.count
- function CheckBuildEntityRequirements(techId, position, player, ignoreEntity)
- // Check if the entity is a Sentry
- if kTechId.Sentry == techId and _Count(_GetEntitiesWithinRange(sentryClassName, position, kSentryBuildRadius)) >= kMaxSentryInArea then
- return false, sentryErrorMessage //legalBuild, errorString
- end
- return base_CheckBuildEntityRequirements(techId, position, player, ignoreEntity)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement