# Developer > Developer API reference for Outpost Category: OUTPOST · Source: https://miciomods.it/docs/ml-base-building-developer · Last updated: 2026-10-21 ## Overview Other resources integrate through server exports and the hooks in `open/server.lua`, `open/client.lua` and `open/shared.lua`. Hooks receive live data: treat `propData` and `prop` as read-only and return quickly. > **WARNING:** Exports answer ml_ resources > > Most server exports answer only resources whose name starts with `ml_` and return `nil`, `false` or `{}` to any other caller. `IsReady`, `GetTotalCount`, `CountPropsByModel`, `GetGeneratorData` and the machine registration exports answer every resource. ```lua local apiVersion = exports.ml_base_building:GetOpenApiVersion() ``` ## Server Exports ### Pieces - `IsReady()`: `true` once bases are loaded - `GetActiveProps()`, `GetTotalCount()`: all placed pieces and their count - `CountPropsByModel(model)`: pieces of one model - `GetPropsByOwner(cid)`, `GetOwnerCount(cid)`: pieces of one character and their count - `IsPropListComplete()`: `true` when every piece has loaded ### Flags and placement - `GetFlagAtCoords(coords, bucket?)`, `GetFlagsAtCoordsBatch(list)`: the flag that covers a position - `GetFlagInfo(flagId)`, `FlagExists(flagId)`, `IsFlagUnderRaid(flagId)` - `CanBuildAt(cid, coords, bucket?)`: whether a character can build there - `GetPlacementInfo(cid, coords, bucket?, permission?)`: flag, owner and permission result at a position - `CanPlaceAt(cid, coords, bucket?, policy?)`, `CanPlaceAtSrc(src, coords, policy?)`: placement check for your own placeable objects ### Crews - `GetCrewByCid(cid)`: the crew of a character, `{ id, name }` - `IsCrewMember(crewId, cid)`, `GetCrewMemberCids(crewId)` - `CrewPermHas(crewId, cid, permName)`: checks a permission from `shared/data/permissions.lua`, such as `'canBuild'` - `GetCrewRaidLockUntil(crewId)`: end of the raid lock of a crew ### Generators and machines - `GetGeneratorData(propId)`, `AddGeneratorFuel(propId, amount, fuelType)` - `RegisterMachine(spec)`, `RegisterMachineVeto(fn)`, `SetMachineOffered(kind, offered)`, `PublishMachineCatalogue(list)`, `ReadoptMachines()`: let another resource add its own machines as base pieces - `CanUseMachine(src, propId)`, `IsMachinePowered(propId)`, `GetMachineLife(propId)`, `RepairMachine(src, propId, amount)`, `GetMachineProps()`, `MachineCapabilities()` ### Beds - `GetPlayerBeds(cid)`, `ResolveBedSpawn(cid, bedId)`, `ClaimRespawn(claim)`: base bed respawns for your death or spawn script ## Client Exports - `IsBuildEntity(entity)`: `true` when the entity is a base piece - `isSheltered()`: `true` while the player stands under a base roof - `MLAdminOpen()`, `MLAdminPanel()`: open the admin panel, and its label and icon for a staff menu ## Server Hooks Located in `open/server.lua`. **open/server.lua** ```lua function MLBB.Hooks.CanPlace(src, model, coords, flagId) end function MLBB.Hooks.CanDamage(attackerSrc, propData, damage, damageContext) end ``` - `CanPlace`: return `false, localeKey` to refuse a placement. `nil` keeps the normal checks. An error or a first value that is not a boolean also refuses - `CanDamage`: return `false` to refuse damage, or `true, newDamage` to replace it Notification hooks, called after the action: - `OnServerReady()` - `OnPropPlaced(src, propData)`, `OnPropRemoved(src, propData, reason)` - `OnPropDamaged(attackerSrc, propData, damage, lifeAfter, damageContext)` - `OnDoorToggled(src, propData, isOpen)`, `OnStorageOpened(src, propData)` - `OnGeneratorRefueled(src, propId, litres, fuelType, fuelAfter)`, `OnPowerChanged(propId, powered)` - `OnExplosivePlanted(src, propData, itemName)` - `OnFlagCreated(flagId, propId, ownerCid)`, `OnFlagRemoved(flagId)` `src` can be `nil` for decay, server removals and offline attackers. Providers, return `nil` to keep the default: - `GetGameHour()`: game hour from 0 to 23, for solar output and `raidSchedule` - `GetWeather()`: GTA weather name, for solar output - `GetWindSpeed(propId, coords)`: wind speed for a turbine in m/s, 0 to 1000, from a trusted server weather resource. Output is speed divided by `ratedSpeed` ## Client Hooks Located in `open/client.lua`. - `OnClientReady()` - `OnPropEnterRange(prop, entity)`, `OnPropExitRange(prop)` - `OnPowerStateChanged(propId, powered)`, `OnDoorStateChanged(propId, isOpen)` - `OnPlacementStarted(model)`, `OnPlacementConfirmed(model, propId)`, `OnPlacementEnded(model)` ## Server Events - `ml_base_building:server:generatorNoise`: fired on the server for each running generator while `Config.Generator.noiseEnabled` is on, with `{ propId, coords, radius, bucket }`. A zombie or AI resource can listen to it ## Examples **Block building near a hospital** **open/server.lua** ```lua function MLBB.Hooks.CanPlace(src, model, coords, flagId) if #(coords - vec3(298.0, -584.0, 43.0)) < 150.0 then return false, 'placement_disabled_zone' end end ``` **Halve raid damage at night** **open/server.lua** ```lua function MLBB.Hooks.CanDamage(attackerSrc, propData, damage, damageContext) local hour = Bridge.GetGameTime() or 12 if hour >= 22 or hour < 6 then return true, damage * 0.5 end end ``` **Check a crew permission from another resource** The calling resource name must start with `ml_`. **ml_yourscript/server.lua** ```lua local crew = exports.ml_base_building:GetCrewByCid(cid) if crew and exports.ml_base_building:CrewPermHas(crew.id, cid, 'canOpenStorages') then end ```