Yes it also has a PushableBlock component and DynamicObstacle component... Is it hopeless ?
Code: Select all
defineObject{
name = "ice_cube",
baseObject = "base_obstacle",
components = {
{
class = "Model",
model = "assets/models/env/pushable_block_01.fbx",
material = "ice_cube",
offset = vec(0, 0.05, 0),
},
{
class = "Light",
offset = vec(0, 1.75, 0),
range = 6,
color = vec(0.2, 0.5, 1),
brightness = 20,
castShadow = false,
fillLight = true,
},
{
class = "Particle",
particleSystem = "force_field",
},
{
class = "Sound",
sound = "force_field_ambient",
},
{
class = "ProjectileCollider",
},
{
class = "Obstacle",
hitSound = "terracotta_jar_hit",
hitEffect = "hit_terracotta_jar",
},
{
class = "Health",
health = 50,
immunities = { "cold" },
},
{
class = "DynamicObstacle",
},
userData,
{
class = "Timer",
timerInterval = 0.001,
triggerOnStart = true,
onActivate = function(self)
self.go.data:set("vz", spells_functions.script.checkUnder(self.go.id, self.go.data:get("vz") or 0, Time.deltaTime()))
end,
},
{
class = "PushableBlock",
},
{
class = "Clickable",
name = "clickNorth",
offset = vec(0, 1.15, 1.2),
size = vec(1.2, 1.2, 0.1),
maxDistance = 1,
--debugDraw = true,
onClick = function(self)
hudPrint("push north!")
--self.go.gravity:setFallingSpeed(1)
if party.facing == (self.go.facing+2) % 4 then
self.go.pushableblock:activate()
if ice_push_source then ice_push_source:destroy() end
spawn("ice_pushable_block_floor", self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation, ice_push_source).controller:activate()
local dx,dy = getForward(party.facing)
if ice_push_target then ice_push_target:destroy() end
spawn("ice_pushable_block_floor", self.go.level, self.go.x+dx, self.go.y+dy, self.go.facing, self.go.elevation, ice_push_target).controller:activate()
self.go.pushableblock:push(party.facing)
end
end,
},
{
class = "Clickable",
name = "clickEast",
offset = vec(1.2, 1.15, 0),
size = vec(0.1, 1.2, 1.2),
maxDistance = 1,
--debugDraw = true,
onClick = function(self)
hudPrint("push east!")
if party.facing == (self.go.facing+3) % 4 then
self.go.pushableblock:activate()
if ice_push_source then ice_push_source:destroy() end
spawn("ice_pushable_block_floor", self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation, ice_push_source).controller:activate()
local dx,dy = getForward(party.facing)
if ice_push_target then ice_push_target:destroy() end
spawn("ice_pushable_block_floor", self.go.level, self.go.x+dx, self.go.y+dy, self.go.facing, self.go.elevation, ice_push_target).controller:activate()
self.go.pushableblock:push(party.facing)
end
end,
},
{
class = "Clickable",
name = "clickSouth",
offset = vec(0, 1.15, -1.2),
size = vec(1.2, 1.2, 0.1),
maxDistance = 1,
--debugDraw = true,
onClick = function(self)
hudPrint("push south!")
if party.facing == self.go.facing then
self.go.pushableblock:activate()
if ice_push_source then ice_push_source:destroy() end
spawn("ice_pushable_block_floor", self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation, ice_push_source).controller:activate()
local dx,dy = getForward(party.facing)
if ice_push_target then ice_push_target:destroy() end
spawn("ice_pushable_block_floor", self.go.level, self.go.x+dx, self.go.y+dy, self.go.facing, self.go.elevation, ice_push_target).controller:activate()
self.go.pushableblock:push(party.facing)
end
end,
},
{
class = "Clickable",
name = "clickWest",
offset = vec(-1.2, 1.15, 0),
size = vec(0.1, 1.2, 1.2),
maxDistance = 1,
--debugDraw = true,
onClick = function(self)
hudPrint("push west!")
if party.facing == (self.go.facing+1) % 4 then
self.go.pushableblock:activate()
if ice_push_source then ice_push_source:destroy() end
spawn("ice_pushable_block_floor", self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation, ice_push_source).controller:activate()
local dx,dy = getForward(party.facing)
if ice_push_target then ice_push_target:destroy() end
spawn("ice_pushable_block_floor", self.go.level, self.go.x+dx, self.go.y+dy, self.go.facing, self.go.elevation, ice_push_target).controller:activate()
self.go.pushableblock:push(party.facing)
end
end,
},
},
placement = "floor",
editorIcon = 272,
tags = { "obstacle" },
}
defineObject{
name = "ice_pushable_block_floor",
baseObject = "base_floor_decoration",
components = {
{
class = "PushableBlockFloor",
name = "controller",
},
},
replacesFloor = false,
}