Add Jorge dialogable NPC

This commit is contained in:
Your Name 2026-08-11 20:10:03 -04:00
parent e5e80c2754
commit 0d05e83c18
11 changed files with 46 additions and 1 deletions

Binary file not shown.

BIN
art/npc/jorge.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
art/npc/jorge_b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
art/npc/jorge_g.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
art/npc/jorge_r.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
art/npc/jorge_reduced.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -23,6 +23,7 @@ require "level_editor/editor"
love.filesystem.setRequirePath(love.filesystem.getRequirePath() .. ";libs/narrator/?.lua") love.filesystem.setRequirePath(love.filesystem.getRequirePath() .. ";libs/narrator/?.lua")
narrator = require "narrator.narrator" narrator = require "narrator.narrator"
startSignBook = require "stories.start_sign" startSignBook = require "stories.start_sign"
jorgeBook = require "stories.jorge"
function love.load() function love.load()
globalAssetProperties = {} -- rebuilt from the filesystem (art/ + .meta) by getAllAssets globalAssetProperties = {} -- rebuilt from the filesystem (art/ + .meta) by getAllAssets

18
npc.lua
View file

@ -20,3 +20,21 @@ function Sign:initialize(x, y)
}, },
}) })
end end
Jorge = class("Jorge", Entity)
Jorge:include(Dialogable)
function Jorge:initialize(x, y)
self.book = jorgeBook
self.saveClass = "jorge"
Entity.initialize(self, {
x = x, y = y,
color = "red",
collision = "unmoveable",
sprites = {
red = loadSprite("art/npc/jorge_r.png"),
green = loadSprite("art/npc/jorge_g.png"),
blue = loadSprite("art/npc/jorge_b.png"),
},
})
end

View file

@ -474,6 +474,11 @@ function Room:createEntity(class, color, x, y)
self:registerNpc(entity) self:registerNpc(entity)
return entity return entity
end end
if class == "jorge" then
local entity = Jorge:new(x, y)
self:registerNpc(entity)
return entity
end
local props = globalAssetProperties and globalAssetProperties[class] local props = globalAssetProperties and globalAssetProperties[class]
local behavior = props and props.class or "immoveable" local behavior = props and props.class or "immoveable"
@ -599,12 +604,25 @@ function Room:attemptDelete(mouseX, mouseY, color)
for index = #self.doors, 1, -1 do for index = #self.doors, 1, -1 do
if removedEntities[self.doors[index]] then table.remove(self.doors, index) end if removedEntities[self.doors[index]] then table.remove(self.doors, index) end
end end
-- NPCs are stamped into every collision layer, but are kept in their own
-- registry rather than in self.collideables. Remove them directly so a
-- right-click works no matter which editor colour is currently selected.
for index = #self.npcs, 1, -1 do
if self.npcs[index]:occupiesCell(cell) then table.remove(self.npcs, index) end
end
self:tick() self:tick()
end end
function Room:attemptPlace(name, props, mouseX, mouseY, color) function Room:attemptPlace(name, props, mouseX, mouseY, color)
if not props or not props.sprites then return end if not props or not props.sprites then return end
local cell = self:getCellFromMousePos(mouseX, mouseY) local cell = self:getCellFromMousePos(mouseX, mouseY)
-- Jorge is one dialogable NPC with three display channels, not three
-- independently placeable color-layer entities.
if name == "jorge" then
self:createEntity(name, nil, cell.x, cell.y)
self:tick()
return
end
-- "white" (or nil) means every channel; otherwise just the picked channel -- "white" (or nil) means every channel; otherwise just the picked channel
local colors local colors
@ -703,7 +721,7 @@ function Room:serialize(includePlayers)
end end
for _, npc in ipairs(self.npcs) do for _, npc in ipairs(self.npcs) do
table.insert(objects, { class = "npc", x = npc.x, y = npc.y }) table.insert(objects, { class = npc.saveClass or "npc", x = npc.x, y = npc.y })
end end
return { objects = objects } return { objects = objects }

7
stories/jorge.ink Normal file
View file

@ -0,0 +1,7 @@
Jorge: I'm Jorge. I'm LGBTQ+, and I spent too long hiding that.
* [Be kind] I'm glad you told me.
Jorge smiles. "Thank you. Being met with kindness makes this place feel safer."
* [Mistreat Jorge] That's not something I respect.
Jorge's smile fades. "You can choose cruelty, but you don't get to define me."
- -> END

1
stories/jorge.lua Normal file
View file

@ -0,0 +1 @@
return {["constants"]={},["tree"]={["_"]={["_"]={"Jorge: I'm Jorge. I'm LGBTQ+, and I spent too long hiding that.",{["node"]={"Jorge smiles. \"Thank you. Being met with kindness makes this place feel safer.\""},["choice"]="Be kind",["text"]="I'm glad you told me."},{["node"]={"Jorge's smile fades. \"You can choose cruelty, but you don't get to define me.\""},["choice"]="Mistreat Jorge",["text"]="That's not something I respect."},{["divert"]={["path"]="END",["tunnel"]=false}}}}},["inclusions"]={},["params"]={},["version"]={["tree"]=1,["engine"]=2},["variables"]={},["lists"]={}}