mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 22:11:51 +00:00
add "triggers" entity property
This commit is contained in:
parent
1f257d2db2
commit
15496070e0
7 changed files with 28 additions and 5 deletions
|
|
@ -1,3 +1,6 @@
|
|||
{
|
||||
"hitbox": [0.2, 0.2, 0.2]
|
||||
"hitbox": [0.2, 0.2, 0.2],
|
||||
"triggers": [
|
||||
[-0.2, -0.2, -0.2, 0.2, 0.2, 0.2]
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ end
|
|||
function on_trigger_enter(index, oid)
|
||||
if ready and oid == 0 then
|
||||
entity:despawn()
|
||||
inventory.add(player.get_inventory(oid), item.index("base:stone.item"), 1)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,13 @@ return {
|
|||
local entity = setmetatable({eid=eid}, Entity)
|
||||
entity.transform = new_Transform(eid)
|
||||
entity.rigidbody = new_Rigidbody(eid)
|
||||
entity.data = {}
|
||||
entities[eid] = entity;
|
||||
return entity
|
||||
end,
|
||||
get_Entity = function(eid)
|
||||
return entities[eid]
|
||||
end,
|
||||
remove_Entity = function(eid)
|
||||
local entity = entities[eid]
|
||||
if entity then
|
||||
|
|
|
|||
|
|
@ -304,6 +304,7 @@ function file.readlines(path)
|
|||
end
|
||||
|
||||
stdcomp = require "core:internal/stdcomp"
|
||||
entity.get = stdcomp.get_Entity
|
||||
|
||||
-- Deprecated functions
|
||||
block_index = block.index
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue