function
world_detach_dyn
world_detach_dyn(target, property)
world_detach_dyn removes a property from a live instance by numeric id, the reflection-ABI counterpart of the static detach Prop on instance. It clears the instance's has-flag for that property so queries and world_has no longer see it, and returns nothing. Use it to take back a runtime-registered or id-only property a mod previously granted with world_attach_dyn. In ordinary compiled code, prefer the detach statement, which also fires the @OnDetach hook before the flag clears.
Parameters
targetthe model instance to modify, an entity handlepropertythe property id to detach, from world_prop_id or world_register_propExample
program RevokeComponent {
property Position { column: int = 0, row: int = 0 }
model Player { Position }
handler Boot phase Start {
spawn Hero { Position { column: 4, row: 4 } }
}
handler DropStamina phase Update {
let stamina_property = world_prop_id("Stamina")
if stamina_property >= 0 {
for (position) in query [Position, {Player}] {
world_detach_dyn(self(), stamina_property)
}
}
}
}