script:world_event:getrayblock
getRayBlock
- Parameters and types:
- srcx,srcy,srcz: numberstarting point
- face: numberdirection enumeration (FACE_DIRECTION) FACE_DIRECTION
- distance: numberthe longest detection distance
- Return value and type:
- code: numberSuccess (ErrorCode.OK) ErrorCode
- blockid: numberblock type ID
- The main function of this method is: The type of block hit by the ray (end when encountering a block)
- The specific use cases are as follows:
--Get the first block id encountered within 50 squares north from (0,0) height 10 --Direction parameters: 0 West 1 East 2 South 3 North 4 Down 5 Up local result,blockid=World:getRayBlock(0,10,0,3,50) if id==-1 then--If there is no block within 50 squares Chat:sendSystemMsg("Starting from (0,0) height 10, there is no block 50 blocks north") else--If there is a block within 50 blocks Chat:sendSystemMsg("Starting from (0,0) height 10, the first block id 50 blocks north is "..blockid) end
script/world_event/getrayblock.txt · Last modified: 2024/06/04 04:05 by don