Compare commits
10 Commits
d20e5392f8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a20b172af | ||
|
|
a01599c001 | ||
|
|
410c00dcd4 | ||
|
|
8edcbe2d9b | ||
|
|
fa62e1428b | ||
|
|
9be52e2b5f | ||
|
|
a3074acb3c | ||
|
|
59726dc2b7 | ||
|
|
f0a9c1acf9 | ||
|
|
1549976382 |
17
code/class.lua
Normal file
17
code/class.lua
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
function class(super, self)
|
||||||
|
assert(super == nil or super.__index == super)
|
||||||
|
self = self or {}
|
||||||
|
self.__index = self
|
||||||
|
setmetatable(self, super)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function getAncestors(self)
|
||||||
|
local family = self
|
||||||
|
local list = {}
|
||||||
|
while family ~= nil do
|
||||||
|
family = getmetatable(family)
|
||||||
|
table.insert(list,family)
|
||||||
|
end
|
||||||
|
return list
|
||||||
|
end
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
Collision = {}
|
Collision = class()
|
||||||
|
|
||||||
LoadedObjects.Collisions = {}
|
LoadedObjects.Collisions = {}
|
||||||
LoadedObjects.Platforms = {}
|
LoadedObjects.Platforms = {}
|
||||||
@@ -48,7 +48,6 @@ function Collision:new(ox,oy,tx,ty)
|
|||||||
end
|
end
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
|
||||||
|
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
Arrow = {}
|
Arrow = class(Entity, {
|
||||||
Arrow.type = "Arrow"
|
type = "Arrow",
|
||||||
Arrow.supertype = Entity.type
|
display = Animation:new(animation.kupo.arrow),
|
||||||
Arrow.display = Animation:new(animation.kupo.arrow)
|
})
|
||||||
setmetatable(Arrow, Entity)
|
|
||||||
|
|
||||||
|
|
||||||
function Arrow:new(x,y,rotation,speed)
|
function Arrow:new(x,y,rotation,speed)
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
CursedBook = {}
|
CursedBook = class(Entity, {
|
||||||
CursedBook.type = "CursedBook"
|
type = "CursedBook",
|
||||||
CursedBook.supertype = Entity.type
|
display = Animation:new(animation.cursed_book.flying),
|
||||||
CursedBook.display = Animation:new(animation.cursed_book.flying)
|
})
|
||||||
setmetatable(CursedBook, Entity)
|
|
||||||
|
|
||||||
function CursedBook:new(x,y)
|
function CursedBook:new(x,y)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
@@ -37,8 +36,6 @@ function CursedBook:new(x,y)
|
|||||||
light_data.color = nil
|
light_data.color = nil
|
||||||
o.light = Light:new(o.pos.x,o.pos.y,light_data)
|
o.light = Light:new(o.pos.x,o.pos.y,light_data)
|
||||||
|
|
||||||
o:id()
|
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o
|
return o
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
Decoration = {}
|
Decoration = class(Entity, {
|
||||||
Decoration.type = "Decoration"
|
type = "Decoration",
|
||||||
Decoration.supertype = Entity.type
|
supertype = Entity.type,
|
||||||
Decoration.display = Animation:new(animation.particle.simple)
|
display = Animation:new(animation.particle.simple),
|
||||||
setmetatable(Decoration, Entity)
|
})
|
||||||
|
|
||||||
function Decoration:new(x,y,animation,light_data)
|
function Decoration:new(x,y,animation,light_data)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
@@ -19,8 +19,6 @@ function Decoration:new(x,y,animation,light_data)
|
|||||||
o.light = Light:new(o.pos.x,o.pos.y,light_data)
|
o.light = Light:new(o.pos.x,o.pos.y,light_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
o:id()
|
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o
|
return o
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
Candelabra = {}
|
Candelabra = class(Decoration, {
|
||||||
Candelabra.type = "Candelabra"
|
type = "Candelabra",
|
||||||
Candelabra.supertype = Decoration.type
|
display = Animation:new(animation.decoration.candelabra),
|
||||||
Candelabra.display = Animation:new(animation.decoration.candelabra)
|
})
|
||||||
setmetatable(Candelabra, Decoration)
|
|
||||||
|
|
||||||
function Candelabra:new(x,y)
|
function Candelabra:new(x,y)
|
||||||
local light_data = {}
|
local light_data = {}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
Fairy = {}
|
Fairy = class(Entity, {
|
||||||
Fairy.type = "Fairy"
|
type = "Fairy",
|
||||||
Fairy.supertype = Entity.type
|
display = Animation:new(animation.fairy.flying),
|
||||||
Fairy.display = Animation:new(animation.fairy.flying)
|
})
|
||||||
setmetatable(Fairy, Entity)
|
|
||||||
|
|
||||||
function Fairy:new(x,y)
|
function Fairy:new(x,y)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
@@ -32,8 +31,6 @@ function Fairy:new(x,y)
|
|||||||
o.particle_timer = 0
|
o.particle_timer = 0
|
||||||
o.particle_time = 5
|
o.particle_time = 5
|
||||||
|
|
||||||
o:id()
|
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o
|
return o
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
HookAnchor = {}
|
HookAnchor = class(Entity, {
|
||||||
HookAnchor.type = "HookAnchor"
|
type = "HookAnchor",
|
||||||
HookAnchor.supertype = Entity.type
|
display = Animation:new(animation.fairy.flying),
|
||||||
HookAnchor.display = Animation:new(animation.fairy.flying)
|
})
|
||||||
setmetatable(HookAnchor, Entity)
|
|
||||||
|
|
||||||
function HookAnchor:new(x,y,hook_distance)
|
function HookAnchor:new(x,y,hook_distance)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
@@ -15,8 +14,6 @@ function HookAnchor:new(x,y,hook_distance)
|
|||||||
o:centerOffset(o.body)
|
o:centerOffset(o.body)
|
||||||
o:createBox(o.body)
|
o:createBox(o.body)
|
||||||
|
|
||||||
o:id()
|
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o
|
return o
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
Kupo = {}
|
Kupo = class(Entity, {
|
||||||
Kupo.type = "Kupo"
|
type = "Kupo",
|
||||||
Kupo.supertype = Entity.type
|
display = Animation:new(animation.kupo.body),
|
||||||
Kupo.display = Animation:new(animation.kupo.body)
|
})
|
||||||
setmetatable(Kupo, Entity)
|
|
||||||
|
|
||||||
function Kupo:new(x,y)
|
function Kupo:new(x,y)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
@@ -37,8 +36,6 @@ function Kupo:new(x,y)
|
|||||||
light_data.color = nil
|
light_data.color = nil
|
||||||
o.light = Light:new(o.pos.x,o.pos.y,light_data)
|
o.light = Light:new(o.pos.x,o.pos.y,light_data)
|
||||||
|
|
||||||
o:id()
|
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o
|
return o
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
LoadedObjects.Particles = {}
|
LoadedObjects.Particles = {}
|
||||||
Particle = {}
|
Particle = class(Entity, {
|
||||||
Particle.type = "Particle"
|
type = "Particle",
|
||||||
Particle.supertype = Entity.type
|
display = Animation:new(animation.particle.simple),
|
||||||
Particle.display = Animation:new(animation.particle.simple)
|
})
|
||||||
setmetatable(Particle, Entity)
|
|
||||||
|
|
||||||
function Particle:new(x,y,particle_data)
|
function Particle:new(x,y,particle_data)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
@@ -23,7 +22,7 @@ function Particle:new(x,y,particle_data)
|
|||||||
o.func = particle_data.func or nil
|
o.func = particle_data.func or nil
|
||||||
o.time = particle_data.time or nil
|
o.time = particle_data.time or nil
|
||||||
|
|
||||||
if o.time ~= nil then
|
if o.time then
|
||||||
if particle_data.time_unit ~= nil
|
if particle_data.time_unit ~= nil
|
||||||
and particle_data.time_unit == "frames" then
|
and particle_data.time_unit == "frames" then
|
||||||
o.time = o.time
|
o.time = o.time
|
||||||
@@ -38,7 +37,7 @@ function Particle:new(x,y,particle_data)
|
|||||||
y = o.speed * math.sin(o.direction)
|
y = o.speed * math.sin(o.direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
if particle_data.light ~= nil then
|
if particle_data.light then
|
||||||
local light_data = {}
|
local light_data = {}
|
||||||
light_data.radius = particle_data.light
|
light_data.radius = particle_data.light
|
||||||
light_data.shine_radius = particle_data.light_shine or nil
|
light_data.shine_radius = particle_data.light_shine or nil
|
||||||
@@ -48,34 +47,24 @@ function Particle:new(x,y,particle_data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- animations
|
-- animations
|
||||||
if particle_data.animation ~= nil then
|
if particle_data.animation then
|
||||||
o.body = Animation:new(particle_data.animation,particle_data.animation_speed)
|
o.body = Animation:new(particle_data.animation,particle_data.animation_speed)
|
||||||
o:centerOffset(o.body)
|
o:centerOffset(o.body)
|
||||||
o:createBox(o.body)
|
o:createBox(o.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- particle id handled differently from other entities
|
table.remove(LoadedObjects.Entities,#LoadedObjects.Entities)
|
||||||
table.insert(LoadedObjects.Particles,o)
|
table.insert(LoadedObjects.Particles,o)
|
||||||
o.id = #LoadedObjects.Particles
|
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|
||||||
function Particle:kill()
|
function Particle:kill()
|
||||||
if self.light ~= nil then
|
if self.light then
|
||||||
self.light:kill()
|
self.light:kill()
|
||||||
end
|
end
|
||||||
if self.id ~= nil then
|
self.dead = true
|
||||||
for _, e in pairs(LoadedObjects.Particles) do
|
|
||||||
if e.id > self.id then
|
|
||||||
e.id = e.id - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
table.remove(LoadedObjects.Particles,self.id)
|
|
||||||
end
|
|
||||||
self = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Particle:handleAnimation()
|
function Particle:handleAnimation()
|
||||||
@@ -85,7 +74,7 @@ function Particle:handleAnimation()
|
|||||||
self.sprite_alpha = self.sprite_alpha_base*(self.time-self.timer)/self.time
|
self.sprite_alpha = self.sprite_alpha_base*(self.time-self.timer)/self.time
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.body ~= nil then
|
if self.body then
|
||||||
self.body:animate()
|
self.body:animate()
|
||||||
self:draw(self.body)
|
self:draw(self.body)
|
||||||
end
|
end
|
||||||
@@ -101,6 +90,15 @@ function Particle:doLogic()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function cleanDeadParticles()
|
||||||
|
for i=1, #LoadedObjects.Particles do
|
||||||
|
part = LoadedObjects.Particles[i]
|
||||||
|
if part.kill then
|
||||||
|
table.remove(LoadedObjects.Particles,i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Particle:doPhysics()
|
function Particle:doPhysics()
|
||||||
-- horizontal collision
|
-- horizontal collision
|
||||||
self:moveX(
|
self:moveX(
|
||||||
@@ -119,3 +117,16 @@ function Particle:debug()
|
|||||||
love.graphics.setColor(0,1,1)
|
love.graphics.setColor(0,1,1)
|
||||||
love.graphics.circle("fill", -Camera.pos.x + self.pos.x, -Camera.pos.y + self.pos.y, 1)
|
love.graphics.circle("fill", -Camera.pos.x + self.pos.x, -Camera.pos.y + self.pos.y, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------
|
||||||
|
|
||||||
|
function cleanDeadParticles()
|
||||||
|
for i=1, #LoadedObjects.Particles do
|
||||||
|
part = LoadedObjects.Particles[i]
|
||||||
|
if part and part.dead then
|
||||||
|
table.remove(LoadedObjects.Particles,i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
Player = {}
|
Player = class(Entity, {
|
||||||
Player.type = "Player"
|
type = "Player",
|
||||||
Player.supertype = Entity.type
|
display = Animation:new(animation.nancy.idle),
|
||||||
Player.display = Animation:new(animation.nancy.idle)
|
})
|
||||||
setmetatable(Player, Entity)
|
|
||||||
|
|
||||||
function Player:new(x,y)
|
function Player:new(x,y)
|
||||||
local o = Entity:new(x,y)
|
local o = Entity:new(x,y)
|
||||||
@@ -81,8 +80,6 @@ function Player:new(x,y)
|
|||||||
light_data.color = nil
|
light_data.color = nil
|
||||||
o.light = Light:new(o.pos.x,o.pos.y,light_data)
|
o.light = Light:new(o.pos.x,o.pos.y,light_data)
|
||||||
|
|
||||||
o:id()
|
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o
|
return o
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
LoadedObjects.Entities = {}
|
LoadedObjects.Entities = {}
|
||||||
Entity = {}
|
Entity = class(nil, {type = "Entity"})
|
||||||
Entity.type = "Entity"
|
|
||||||
|
|
||||||
function Entity:new(x,y)
|
function Entity:new(x,y)
|
||||||
local o = {}
|
local o = {}
|
||||||
@@ -25,16 +24,12 @@ function Entity:new(x,y)
|
|||||||
o.sprite_alpha = 1
|
o.sprite_alpha = 1
|
||||||
o.sprite_flip = { x = 1, y = 1}
|
o.sprite_flip = { x = 1, y = 1}
|
||||||
|
|
||||||
|
table.insert(LoadedObjects.Entities,o)
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|
||||||
function Entity:id()
|
|
||||||
table.insert(LoadedObjects.Entities,self)
|
|
||||||
self.id = #LoadedObjects.Entities
|
|
||||||
end
|
|
||||||
|
|
||||||
function Entity:checkNearest(type,maxdistance)
|
function Entity:checkNearest(type,maxdistance)
|
||||||
local return_entity = nil
|
local return_entity = nil
|
||||||
local shortest = -1
|
local shortest = -1
|
||||||
@@ -66,9 +61,6 @@ function Entity:checkNearest(type,maxdistance)
|
|||||||
return return_entity
|
return return_entity
|
||||||
end
|
end
|
||||||
|
|
||||||
function Entity:doLogic()
|
|
||||||
end
|
|
||||||
|
|
||||||
function Entity:moveX(amount, func)
|
function Entity:moveX(amount, func)
|
||||||
self.move_remainder.x = self.move_remainder.x + amount
|
self.move_remainder.x = self.move_remainder.x + amount
|
||||||
local move = math.round(self.move_remainder.x)
|
local move = math.round(self.move_remainder.x)
|
||||||
@@ -132,15 +124,7 @@ function Entity:kill()
|
|||||||
if self.light ~= nil then
|
if self.light ~= nil then
|
||||||
self.light:kill()
|
self.light:kill()
|
||||||
end
|
end
|
||||||
if self.id ~= nil then
|
self.dead = true
|
||||||
table.remove(LoadedObjects.Entities,self.id)
|
|
||||||
for _, e in pairs(LoadedObjects.Entities) do
|
|
||||||
if e.id > self.id then
|
|
||||||
e.id = e.id - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self = nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Entity:checkVisionLine(entity,range)
|
function Entity:checkVisionLine(entity,range)
|
||||||
@@ -308,6 +292,9 @@ function Entity:debug()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Entity:doLogic()
|
||||||
|
end
|
||||||
|
|
||||||
function Entity:doPhysics()
|
function Entity:doPhysics()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -317,6 +304,19 @@ end
|
|||||||
function Entity:drawBackground()
|
function Entity:drawBackground()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------
|
||||||
|
|
||||||
|
function cleanDeadEntities()
|
||||||
|
for i=1, #LoadedObjects.Entities do
|
||||||
|
enty = LoadedObjects.Entities[i]
|
||||||
|
if enty and enty.dead then
|
||||||
|
table.remove(LoadedObjects.Entities,i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------
|
||||||
|
|
||||||
require "code/entities/kupo"
|
require "code/entities/kupo"
|
||||||
require "code/entities/arrow"
|
require "code/entities/arrow"
|
||||||
require "code/entities/decoration"
|
require "code/entities/decoration"
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ function stepGame()
|
|||||||
Demo:startPlayback()
|
Demo:startPlayback()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
cleanDeadParticles()
|
||||||
|
cleanDeadEntities()
|
||||||
|
cleanDeadLights()
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawGame()
|
function drawGame()
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
Light = {}
|
Light = class(nil, {
|
||||||
|
type = "Light"
|
||||||
|
})
|
||||||
LoadedObjects.Lights = {}
|
LoadedObjects.Lights = {}
|
||||||
|
|
||||||
function Light:new(x,y,data)
|
function Light:new(x,y,data)
|
||||||
@@ -17,26 +19,12 @@ function Light:new(x,y,data)
|
|||||||
o.flicker_time = 60/12
|
o.flicker_time = 60/12
|
||||||
o.flicker_timer = 0
|
o.flicker_timer = 0
|
||||||
|
|
||||||
table.insert(LoadedObjects.Lights,o)
|
|
||||||
o.id = #LoadedObjects.Lights
|
|
||||||
|
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
self.__index = self
|
||||||
|
table.insert(LoadedObjects.Lights,o)
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|
||||||
function Light:kill()
|
|
||||||
if self.id ~= nil then
|
|
||||||
table.remove(LoadedObjects.Lights,self.id)
|
|
||||||
for _, e in pairs(LoadedObjects.Lights) do
|
|
||||||
if e.id > self.id then
|
|
||||||
e.id = e.id - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function Light:flicker()
|
function Light:flicker()
|
||||||
self.flicker_timer = self.flicker_timer + 1
|
self.flicker_timer = self.flicker_timer + 1
|
||||||
|
|
||||||
@@ -82,3 +70,20 @@ function Light:drawShine()
|
|||||||
love.graphics.setShader()
|
love.graphics.setShader()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Light:kill()
|
||||||
|
self.dead = true
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------
|
||||||
|
|
||||||
|
function cleanDeadLights()
|
||||||
|
for i=1, #LoadedObjects.Lights do
|
||||||
|
light = LoadedObjects.Lights[i]
|
||||||
|
if light and light.dead then
|
||||||
|
table.remove(LoadedObjects.Lights,i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ require "data/sfx"
|
|||||||
require "code/locale"
|
require "code/locale"
|
||||||
|
|
||||||
-- support functions
|
-- support functions
|
||||||
|
require "code/class"
|
||||||
require "code/math"
|
require "code/math"
|
||||||
require "code/draw"
|
require "code/draw"
|
||||||
require "code/hex"
|
require "code/hex"
|
||||||
|
|||||||
@@ -244,7 +244,13 @@ function drawSpawns()
|
|||||||
)
|
)
|
||||||
|
|
||||||
if spawn.selected then
|
if spawn.selected then
|
||||||
local text = spawn.archetype.type.."\n("..spawn.archetype.supertype..")\n---\nPosition\n["..spawn.args[1]..","..spawn.args[2].."]"
|
local text = spawn.archetype.type .."\n("
|
||||||
|
local ancestors = getAncestors(spawn.archetype)
|
||||||
|
for i=1, #ancestors do
|
||||||
|
if i > 1 then text = text .. ", " end
|
||||||
|
text = text .. ancestors[i].type
|
||||||
|
end
|
||||||
|
text = text ..")\n---\nPosition\n["..spawn.args[1]..","..spawn.args[2].."]"
|
||||||
if #spawn.args > 2 then
|
if #spawn.args > 2 then
|
||||||
text = text .. "\n---\nData:\n"
|
text = text .. "\n---\nData:\n"
|
||||||
for i=3, #spawn.args do
|
for i=3, #spawn.args do
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ local function backspace(text)
|
|||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
Prompt = {
|
Prompt = class(nil, {
|
||||||
-- defaults for instance variables
|
-- defaults for instance variables
|
||||||
pos = { x = 10, y = 10 },
|
pos = { x = 10, y = 10 },
|
||||||
input = "",
|
input = "",
|
||||||
@@ -23,7 +23,7 @@ Prompt = {
|
|||||||
color = {1,1,1,1},
|
color = {1,1,1,1},
|
||||||
background_color = {0,0,0,1},
|
background_color = {0,0,0,1},
|
||||||
active_prompt = nil,
|
active_prompt = nil,
|
||||||
}
|
})
|
||||||
function Prompt:cancelActive()
|
function Prompt:cancelActive()
|
||||||
if Prompt.active_prompt then
|
if Prompt.active_prompt then
|
||||||
Prompt.active_prompt.canceled = true
|
Prompt.active_prompt.canceled = true
|
||||||
@@ -33,7 +33,6 @@ end
|
|||||||
function Prompt:new(o)
|
function Prompt:new(o)
|
||||||
o = o or {}
|
o = o or {}
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
self.__index = self
|
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user