Adjustable Laser Drill Ingame Scripting Reference Purpose - This file lists the scripting-relevant properties, actions, and settings of the Adjustable Laser Drill. - It is intended for Space Engineers Programmable Block users. - The block is based on IMyShipWelder / IMyShipToolBase, so both mod-specific and vanilla members are available. Important Notes - Mod-specific IDs use the AdjustableLaserDrill.* prefix to avoid collisions with vanilla or other modded terminal IDs. - Control properties are writable and normally visible in the terminal UI. - Status properties are read-only, hidden from the terminal UI, and meant for Programmable Block logic. - RadiusLarge and RadiusSmall terminal sliders represent DIAMETER in the block UI. - CustomData uses the real Radius value. - RangeLarge/RadiusLarge are for large-grid drills. RangeSmall/RadiusSmall are for small-grid drills. - Per-block status properties describe the selected drill only. Grid* status properties aggregate all laser drills registered on the same mechanical construct. - Construct mined resource counters count generated ore once, before cargo distribution. - GridMinedResourceAmount keeps the raw inventory item amount for compatibility. - GridMinedResourceMassKg and the Mining Display show mined resources as mass in kg/t. ====================================================================== 1. Writable Mod-Specific Terminal Control / Property IDs ====================================================================== Use with: - block.GetProperty(...) - block.GetValueBool(...) - block.SetValueBool(...) - block.GetValueFloat(...) - block.SetValueFloat(...) UI-only entries in this section are terminal controls, not writable PB properties. Boolean AdjustableLaserDrill.ContinuousFire - Type: bool - Purpose: Enables or disables continuous firing. AdjustableLaserDrill.TerrainClearing - Type: bool - Purpose: Removes terrain without collecting ore. AdjustableLaserDrill.IgnoreStone - Type: bool - Purpose: Prevents stone from being collected. - Note: Ore, ice, and other non-stone mined resources are still collected normally. AdjustableLaserDrill.ShowGizmo - Type: bool - Purpose: Shows or hides the drill gizmo / drilling capsule. Float AdjustableLaserDrill.RangeLarge - Type: float - Purpose: Laser range in meters for the large-grid drill. AdjustableLaserDrill.RangeSmall - Type: float - Purpose: Laser range in meters for the small-grid drill. AdjustableLaserDrill.RadiusLarge - Type: float - Purpose: Laser DIAMETER in meters for the large-grid drill terminal UI. - Note: This is diameter, not radius. AdjustableLaserDrill.RadiusSmall - Type: float - Purpose: Laser DIAMETER in meters for the small-grid drill terminal UI. - Note: This is diameter, not radius. UI Only AdjustableLaserDrill.Separator - Purpose: Terminal UI separator only. - Not useful for PB scripting. AdjustableLaserDrill.ResetGridMinedResourcesButton - Purpose: Terminal UI button for "Reset Mining Counter". - Not useful for PB scripting. - PB alternative: Use the action AdjustableLaserDrill.ResetGridMinedResources. ====================================================================== 2. Read-Only Mod-Specific Status Properties ====================================================================== Use with: - block.GetValueBool(...) - block.GetValueFloat(...) - block.GetValue(...) These properties are hidden from the block terminal UI but are accessible to Programmable Blocks. Their setters intentionally do nothing. Boolean AdjustableLaserDrill.IsFiring - Type: bool - Purpose: True when the laser is currently firing according to the drill logic. AdjustableLaserDrill.IsMining - Type: bool - Purpose: True when the laser is firing and currently removing voxel material. AdjustableLaserDrill.HasVoxelContact - Type: bool - Purpose: True when the active beam currently has voxel/contact information. AdjustableLaserDrill.InventoryBlocked - Type: bool - Purpose: True when ore collection is blocked or would be blocked because the drill/grid drill buffer has no free storage. - Note: Terrain Clearing mode ignores ore storage and reports false here. AdjustableLaserDrill.InsufficientPower - Type: bool - Purpose: True when current requested power is not fully supplied. AdjustableLaserDrill.GridIsFiring - Type: bool - Purpose: True when any laser drill on the same mechanical construct is currently firing. AdjustableLaserDrill.GridIsMining - Type: bool - Purpose: True when any laser drill on the same mechanical construct is currently removing voxel material. AdjustableLaserDrill.GridHasVoxelContact - Type: bool - Purpose: True when any active laser drill on the same mechanical construct currently has voxel/contact information. AdjustableLaserDrill.GridInventoryBlocked - Type: bool - Purpose: True when any laser drill on the same mechanical construct reports ore collection blocked by drill buffer storage. AdjustableLaserDrill.GridInsufficientPower - Type: bool - Purpose: True when any laser drill on the same mechanical construct reports insufficient power. Float AdjustableLaserDrill.LastContactDistance - Type: float - Unit: meters - Purpose: Distance to the current/last active voxel contact. - Value: -1 when there is no active contact. AdjustableLaserDrill.RequiredPowerMW - Type: float - Unit: MW - Purpose: Active drilling power requirement based on current range/radius settings. - Note: This is the active requirement, not idle power. AdjustableLaserDrill.AvailablePowerMW - Type: float - Unit: MW - Purpose: Power currently reported as available to the block's resource sink. AdjustableLaserDrill.CurrentPowerMW - Type: float - Unit: MW - Purpose: Current actual input reported by the block's resource sink. AdjustableLaserDrill.InventoryFillRatio - Type: float - Range: 0.0 to 1.0 - Purpose: Fill ratio of this drill's own inventory. AdjustableLaserDrill.GridDrillStorageFreeL - Type: float - Unit: liters - Purpose: Free storage across all laser drill buffer inventories on the same mechanical construct. - Note: This tracks the drill-side buffer capacity used before ore distribution. AdjustableLaserDrill.GridCurrentPowerMW - Type: float - Unit: MW - Purpose: Sum of current actual power input across laser drills on the same mechanical construct. AdjustableLaserDrill.GridRequiredPowerMW - Type: float - Unit: MW - Purpose: Sum of active drilling power requirements across laser drills on the same mechanical construct. - Note: This mirrors RequiredPowerMW semantics and does not include idle power. AdjustableLaserDrill.GridInventoryFillRatio - Type: float - Range: 0.0 to 1.0 - Purpose: Aggregate fill ratio of laser drill buffer inventories on the same mechanical construct. AdjustableLaserDrill.GridMinedResourceAmount - Type: float - Purpose: Total mined ore inventory units accepted into the mechanical construct laser drill buffer since session load or the last reset. - Note: Counts generated ore once, before cargo distribution, so multiple drills and conveyors do not double-count it. AdjustableLaserDrill.GridMinedResourceMassKg - Type: float - Unit: kg - Purpose: Total mined ore mass accepted into the mechanical construct laser drill buffer since session load or the last reset. - Note: This is the recommended value for crafting/resource display logic. String AdjustableLaserDrill.BlockedReason - Type: string - Purpose: Human-readable machine state for scripts and LCDs. - Possible values: - None - NotReady - Damaged - Disabled - NoPower - InventoryFull - NoVoxelContact AdjustableLaserDrill.GridMinedResourceSummary - Type: string - Purpose: Per-resource mechanical construct counter summary for scripts and LCDs. - Format: Subtype=amount; Subtype=amount - Example: Iron=123.5; Nickel=42; Stone=800 - Value: None when nothing has been counted yet or after reset. AdjustableLaserDrill.GridMinedResourceMassSummary - Type: string - Purpose: Per-resource mechanical construct mass counter summary for scripts and LCDs. - Format: Subtype=kg; Subtype=kg - Example: Iron=123.5; Nickel=42; Stone=800 - Value: None when nothing has been counted yet or after reset. AdjustableLaserDrill.GridBlockedReason - Type: string - Purpose: Aggregate machine state for all laser drills on the same mechanical construct. - Possible values: None, NotReady, Damaged, Disabled, NoPower, InventoryFull, NoVoxelContact. ====================================================================== 3. Mod-Specific Terminal Actions ====================================================================== Use with: - block.ApplyAction(...) - block.GetActionWithName(...) - block.SearchActionsOfName(...) Firing AdjustableLaserDrill.FireToggle - Purpose: Toggles Continuous Fire. AdjustableLaserDrill.FireOn - Purpose: Enables Continuous Fire. AdjustableLaserDrill.FireOff - Purpose: Disables Continuous Fire. Adjustment AdjustableLaserDrill.RangeIncrease - Purpose: Increases laser range by 1.0 meter. AdjustableLaserDrill.RangeDecrease - Purpose: Decreases laser range by 1.0 meter. AdjustableLaserDrill.RadiusIncrease - Purpose: Increases the real laser radius by 0.1 meter. - Note: The terminal diameter value changes by 0.2 meters. AdjustableLaserDrill.RadiusDecrease - Purpose: Decreases the real laser radius by 0.1 meter. - Note: The terminal diameter value changes by 0.2 meters. Safety / State AdjustableLaserDrill.StopAndReset - Purpose: Turns Continuous Fire off and clears the drill's current mining/contact progress state. AdjustableLaserDrill.ResetGridMinedResources - Purpose: Resets the mined resource counters for the laser drill mechanical construct. - Note: Safe to call from any laser drill on that mechanical construct. If applied to a group, repeated resets are harmless. - UI: The laser drill terminal also has a "Reset Mining Counter" button for the same reset. AdjustableLaserDrill.SafeEnable - Purpose: Enables Continuous Fire only when the block is functional, drill buffer storage is available, and active power appears sufficient. - If blocked, Continuous Fire is turned off. ====================================================================== 4. Mod-Specific CustomData Keys ====================================================================== Section [AdjustableLaserDrill] Keys Range - Type: float - Purpose: Laser range in meters. Radius - Type: float - Purpose: Real laser radius in meters. - Note: This is radius, not diameter. ContinuousFire - Type: bool - Purpose: Enables or disables continuous firing. TerrainClearingMode - Type: bool - Purpose: Removes terrain without collecting ore. IgnoreStone - Type: bool - Purpose: Prevents stone from being collected while still collecting ore, ice, and other non-stone mined resources. ShowGizmo - Type: bool - Purpose: Shows or hides the gizmo. Initialized - Type: bool - Purpose: Internal initialization marker. - Recommendation: Do not modify this manually. Example CustomData [AdjustableLaserDrill] Range=40 Radius=1.25 ContinuousFire=false TerrainClearingMode=false IgnoreStone=false ShowGizmo=false ====================================================================== 5. Vanilla / Inherited PB Members ====================================================================== These are not mod-added terminal IDs. They come from the block's inherited PB interfaces. The list below was checked against the local Space Engineers in-game interfaces exposed by the drill block. IMyShipWelder HelpOthers - Type: bool - Purpose: Vanilla welder setting. - Note: Hidden in the mod UI and generally not useful for this mod. IMyShipToolBase IsActivated - Type: bool - Purpose: True while the tool is currently activated. UseConveyorSystem - Type: bool - Purpose: Enables or disables conveyor usage. IMyFunctionalBlock Enabled - Type: bool - Purpose: Standard functional block On/Off state. RequestEnable(bool) - Purpose: Legacy enable request. - Recommendation: Prefer using Enabled directly. IMyTerminalBlock CustomData - Type: string - Purpose: Read or write the block's CustomData. CustomInfo - Type: string - Purpose: Additional info text appended by the mod. CustomName - Type: string - Purpose: Terminal name of the block. CustomNameWithFaction - Type: string - Purpose: Terminal name including faction tag where available. DetailedInfo - Type: string - Purpose: Standard detailed info text shown in terminal. ShowOnHUD - Type: bool - Purpose: Shows the block on HUD. ShowInTerminal - Type: bool - Purpose: Shows the block in terminal lists. ShowInToolbarConfig - Type: bool - Purpose: Shows the block in toolbar configuration. ShowInInventory - Type: bool - Purpose: Shows the block in inventory screen lists. GetActions(...) - Purpose: Get terminal actions available on the block. SearchActionsOfName(...) - Purpose: Search actions by name. GetActionWithName(...) - Purpose: Get one action by name. GetProperties(...) - Purpose: Get terminal properties available on the block. GetProperty(string id) - Purpose: Get a terminal property by ID. HasLocalPlayerAccess() - Purpose: Check whether the local player can access the block. HasNobodyPlayerAccessToBlock() - Purpose: Check whether the "Nobody" identity has access to the block. HasPlayerAccess(...) - Purpose: Check access for a specific player. HasPlayerAccessWithNobodyCheck(...) - Purpose: Check access for a player while also considering "Nobody" ownership/access. IsSameConstructAs(IMyTerminalBlock) - Purpose: Checks whether two blocks are on the same mechanical construct. SetCustomName(string) - Purpose: Sets the block's terminal name. SetCustomName(StringBuilder) - Purpose: Sets the block's terminal name from a StringBuilder. IMyCubeBlock BlockDefinition - Type: definition object - Purpose: Block definition access. CubeGrid - Type: grid object - Purpose: Owning grid. DefinitionDisplayNameText - Type: string - Purpose: Localized block definition name. DisassembleRatio - Type: float - Purpose: Vanilla build/disassembly ratio state. DisplayNameText - Type: string - Purpose: Display name of the block. IsBeingHacked - Type: bool - Purpose: True while the block is being hacked. IsFunctional - Type: bool - Purpose: True if the block is fully built and functional. IsWorking - Type: bool - Purpose: True if the block can currently operate. Mass - Type: float - Purpose: Current block mass. Min - Type: Vector3I - Purpose: Minimum grid coordinate occupied by the block. Max - Type: Vector3I - Purpose: Maximum grid coordinate occupied by the block. NumberInGrid - Type: int - Purpose: Internal grid block number. Orientation - Type: MyBlockOrientation - Purpose: Block orientation on the grid. OwnerId - Type: long - Purpose: Owner identity ID. Position - Type: Vector3I - Purpose: Grid position. GetOwnerFactionTag() - Purpose: Returns owner faction tag. GetPlayerRelationToOwner() - Purpose: Returns player relation to owner. GetUserRelationToOwner(...) - Purpose: Returns relation between a specific player and the owner. UpdateIsWorking() - Purpose: Requests a refresh of the vanilla working-state calculation. UpdateVisual() - Purpose: Requests a visual refresh of the block. IMyEntity Closed - Type: bool - Purpose: True after the entity is closed/removed. Components - Type: component container - Purpose: Entity component container. EntityId - Type: long - Purpose: Unique entity ID. DisplayName - Type: string - Purpose: User-facing entity name. Name - Type: string - Purpose: Internal entity name. HasInventory - Type: bool - Purpose: True if the block has at least one inventory. InventoryCount - Type: int - Purpose: Number of inventories. WorldMatrix - Type: matrix - Purpose: World transform matrix. WorldAABB - Type: BoundingBoxD - Purpose: World-space entity bounding box. WorldAABBHr - Type: BoundingBoxD - Purpose: High-resolution world-space entity bounding box. WorldVolume - Type: BoundingSphereD - Purpose: World-space bounding sphere. WorldVolumeHr - Type: BoundingSphereD - Purpose: High-resolution world-space bounding sphere. GetInventory() - Purpose: Returns the first inventory. GetInventory(int index) - Purpose: Returns inventory by index. GetPosition() - Purpose: Returns world position. ====================================================================== 6. Recommended Practical Control Surface ====================================================================== Writable terminal properties - AdjustableLaserDrill.ContinuousFire - AdjustableLaserDrill.TerrainClearing - AdjustableLaserDrill.IgnoreStone - AdjustableLaserDrill.ShowGizmo - AdjustableLaserDrill.RangeLarge or AdjustableLaserDrill.RangeSmall - AdjustableLaserDrill.RadiusLarge or AdjustableLaserDrill.RadiusSmall Read-only status properties - AdjustableLaserDrill.IsFiring - AdjustableLaserDrill.IsMining - AdjustableLaserDrill.HasVoxelContact - AdjustableLaserDrill.LastContactDistance - AdjustableLaserDrill.InventoryBlocked - AdjustableLaserDrill.InsufficientPower - AdjustableLaserDrill.RequiredPowerMW - AdjustableLaserDrill.AvailablePowerMW - AdjustableLaserDrill.CurrentPowerMW - AdjustableLaserDrill.InventoryFillRatio - AdjustableLaserDrill.GridDrillStorageFreeL - AdjustableLaserDrill.BlockedReason - AdjustableLaserDrill.GridIsFiring - AdjustableLaserDrill.GridIsMining - AdjustableLaserDrill.GridHasVoxelContact - AdjustableLaserDrill.GridInventoryBlocked - AdjustableLaserDrill.GridInsufficientPower - AdjustableLaserDrill.GridCurrentPowerMW - AdjustableLaserDrill.GridRequiredPowerMW - AdjustableLaserDrill.GridInventoryFillRatio - AdjustableLaserDrill.GridMinedResourceAmount - AdjustableLaserDrill.GridMinedResourceSummary - AdjustableLaserDrill.GridMinedResourceMassKg - AdjustableLaserDrill.GridMinedResourceMassSummary - AdjustableLaserDrill.GridBlockedReason Actions - AdjustableLaserDrill.FireOn - AdjustableLaserDrill.FireOff - AdjustableLaserDrill.FireToggle - AdjustableLaserDrill.RangeIncrease - AdjustableLaserDrill.RangeDecrease - AdjustableLaserDrill.RadiusIncrease - AdjustableLaserDrill.RadiusDecrease - AdjustableLaserDrill.StopAndReset - AdjustableLaserDrill.ResetGridMinedResources - AdjustableLaserDrill.SafeEnable Vanilla members - Enabled - UseConveyorSystem - IsActivated - IsWorking - CustomData - CustomInfo - GetInventory() ====================================================================== 7. PB Examples ====================================================================== Find a drill IMyShipWelder drill = GridTerminalSystem.GetBlockWithName("Laser Drill") as IMyShipWelder; Enable Continuous Fire drill?.ApplyAction("AdjustableLaserDrill.FireOn"); Disable Continuous Fire drill?.ApplyAction("AdjustableLaserDrill.FireOff"); Safe enable drill?.ApplyAction("AdjustableLaserDrill.SafeEnable"); Stop and reset drill?.ApplyAction("AdjustableLaserDrill.StopAndReset"); Reset mechanical construct mined resource counters drill?.ApplyAction("AdjustableLaserDrill.ResetGridMinedResources"); Set large-grid range drill?.SetValueFloat("AdjustableLaserDrill.RangeLarge", 40f); Set small-grid range drill?.SetValueFloat("AdjustableLaserDrill.RangeSmall", 15f); Set large-grid diameter drill?.SetValueFloat("AdjustableLaserDrill.RadiusLarge", 2.0f); Set small-grid diameter drill?.SetValueFloat("AdjustableLaserDrill.RadiusSmall", 1.0f); Increase range by action step drill?.ApplyAction("AdjustableLaserDrill.RangeIncrease"); Decrease real radius by action step drill?.ApplyAction("AdjustableLaserDrill.RadiusDecrease"); Enable Terrain Clearing drill?.SetValueBool("AdjustableLaserDrill.TerrainClearing", true); Ignore stone collection drill?.SetValueBool("AdjustableLaserDrill.IgnoreStone", true); Hide Gizmo drill?.SetValueBool("AdjustableLaserDrill.ShowGizmo", false); Read status values bool isFiring = drill != null && drill.GetValue("AdjustableLaserDrill.IsFiring"); bool isMining = drill != null && drill.GetValue("AdjustableLaserDrill.IsMining"); bool inventoryBlocked = drill != null && drill.GetValue("AdjustableLaserDrill.InventoryBlocked"); bool insufficientPower = drill != null && drill.GetValue("AdjustableLaserDrill.InsufficientPower"); float contactDistance = drill != null ? drill.GetValue("AdjustableLaserDrill.LastContactDistance") : -1f; string blockedReason = drill != null ? drill.GetValue("AdjustableLaserDrill.BlockedReason") : "NoBlock"; bool gridMining = drill != null && drill.GetValue("AdjustableLaserDrill.GridIsMining"); float gridMinedMassKg = drill != null ? drill.GetValue("AdjustableLaserDrill.GridMinedResourceMassKg") : 0f; string gridMinedMassSummary = drill != null ? drill.GetValue("AdjustableLaserDrill.GridMinedResourceMassSummary") : "None"; Example LCD/status Echo if (drill == null) { Echo("Laser Drill not found."); return; } Echo("Firing: " + drill.GetValue("AdjustableLaserDrill.IsFiring")); Echo("Mining: " + drill.GetValue("AdjustableLaserDrill.IsMining")); string warning = drill.GetValue("AdjustableLaserDrill.BlockedReason"); if (warning != "None" && warning != "NoVoxelContact") Echo("Warning: " + warning); Echo("Required MW: " + drill.GetValue("AdjustableLaserDrill.RequiredPowerMW").ToString("0.00")); Echo("Current MW: " + drill.GetValue("AdjustableLaserDrill.CurrentPowerMW").ToString("0.00")); Echo("Inventory: " + (drill.GetValue("AdjustableLaserDrill.GridInventoryFillRatio") * 100f).ToString("0.0") + "%"); Echo("Grid mining: " + drill.GetValue("AdjustableLaserDrill.GridIsMining")); Echo("Construct mined kg: " + drill.GetValue("AdjustableLaserDrill.GridMinedResourceMassKg").ToString("0.###")); Echo("Construct ores kg: " + drill.GetValue("AdjustableLaserDrill.GridMinedResourceMassSummary")); Example automatic safe firing if (drill == null) return; string reason = drill.GetValue("AdjustableLaserDrill.BlockedReason"); if (reason == "None" || reason == "NoVoxelContact") { drill.ApplyAction("AdjustableLaserDrill.SafeEnable"); } else { drill.ApplyAction("AdjustableLaserDrill.FireOff"); Echo("Laser blocked: " + reason); } Write CustomData directly var ini = new MyIni(); ini.TryParse(drill.CustomData); ini.Set("AdjustableLaserDrill", "Range", 40f); ini.Set("AdjustableLaserDrill", "Radius", 1.25f); ini.Set("AdjustableLaserDrill", "ContinuousFire", false); ini.Set("AdjustableLaserDrill", "TerrainClearingMode", false); ini.Set("AdjustableLaserDrill", "IgnoreStone", false); ini.Set("AdjustableLaserDrill", "ShowGizmo", false); drill.CustomData = ini.ToString(); ====================================================================== 8. Final Notes ====================================================================== - Use the mod-specific action IDs for firing-related automation. - Use read-only status properties for PB logic instead of parsing CustomInfo. - Use CustomData if you want a stable text-based config format. - Use terminal property IDs if you want quick direct control from PB code. - Use Grid* properties when one PB should monitor a whole group of laser drills on the same mechanical construct. - ResetGridMinedResources resets the mechanical construct counter only; StopAndReset does not clear mined resource statistics. - LCD/text surface users can select the "Mining Display" script to show mined resource mass, colored status/warnings, and an inventory fill bar on a display. - Text surface script ID: TSS_AdjustableLaserDrillMiningDisplay - Remember the diameter vs radius distinction: - Terminal slider IDs use diameter. - RadiusIncrease/RadiusDecrease actions use real radius. - CustomData uses real radius.