remove items and npcs

This commit is contained in:
2026-02-17 16:51:30 +01:00
parent 971acb02ca
commit 9a65891afa
10 changed files with 44 additions and 398 deletions

View File

@@ -1,13 +1,12 @@
meta/meta.header.lua
init/init.modules.lua
init/init.config.lua
system/system.util.lua
init/init.windows.lua
init/init.context.lua
data/data.songs.lua
system/system.print.lua
system/system.util.lua
entity/entity.npc.lua
entity/entity.item.lua
system/system.actions.lua
system/system.input.lua
system/system.audio.lua
system/system.ui.lua

View File

@@ -1,7 +0,0 @@
function Item.use()
Print.text("Used item: " .. Context.dialog.active_entity.name)
end
function Item.look_at()
PopupWindow.show_description_dialog(Context.dialog.active_entity, Context.dialog.active_entity.desc)
end

View File

@@ -1,13 +0,0 @@
function NPC.talk_to()
local npc = Context.dialog.active_entity
if npc.dialog and npc.dialog.start then
PopupWindow.set_dialog_node("start")
else
-- if no dialog, go back
GameWindow.set_state(WINDOW_GAME)
end
end
function NPC.fight() end
function NPC.go_back()
GameWindow.set_state(WINDOW_GAME)
end

View File

@@ -8,7 +8,6 @@ local DEFAULT_CONFIG = {
light_grey = 13,
dark_grey = 14,
green = 6,
npc = 8,
item = 12 -- yellow
},
player = {

View File

@@ -51,137 +51,6 @@ local function get_initial_data()
screens = clone_table({
{
name = "Screen 1",
npcs = {
{
name = "Button Mash Minigame",
sprite_id = 4,
dialog = {
start = {
text = "Ready to test your reflexes? Prove your speed!",
options = {
{label = "Let's do it!", next_node = "__MINIGAME_BUTTON_MASH__"},
{label = "Not now.", next_node = "dialog_end"}
}
},
dialog_end = {
text = "Come back when you're ready.",
options = {}
}
}
},
{
name = "Trinity",
sprite_id = 2,
dialog = {
start = {
text = "Hello, Neo.",
options = {
{label = "Who are you?", next_node = "who_are_you"},
{label = "My name is not Neo.", next_node = "not_neo"},
{label = "...", next_node = "silent"}
}
},
who_are_you = {
text = "I am Trinity. I've been looking for you.",
options = {
{label = "The famous hacker?", next_node = "famous_hacker"},
{label = "Why me?", next_node = "why_me"}
}
},
not_neo = {
text = "I know. But you will be.",
options = {
{label = "What are you talking about?", next_node = "who_are_you"}
}
},
silent = {
text = "You're not much of a talker, are you?",
options = {
{label = "I guess not.", next_node = "dialog_end"}
}
},
famous_hacker = {
text = "The one and only.",
options = {
{label = "Wow.", next_node = "dialog_end"}
}
},
why_me = {
text = "Morpheus believes you are The One.",
options = {
{label = "The One?", next_node = "the_one"}
}
},
the_one = {
text = "The one who will save us all.",
options = {
{label = "I'm just a programmer.", next_node = "dialog_end"}
}
},
dialog_end = {
text = "We'll talk later.",
options = {} -- No options, ends conversation
}
}
},
{
name = "Oracle",
sprite_id = 3,
dialog = {
start = {
text = "I know what you're thinking. 'Am I in the right place?'",
options = {
{label = "Who are you?", next_node = "who_are_you"},
{label = "I guess I am.", next_node = "you_are"}
}
},
who_are_are = {
text = "I'm the Oracle. And you're right on time. Want a cookie?",
options = {
{label = "Sure.", next_node = "cookie"},
{label = "No, thank you.", next_node = "no_cookie"}
}
},
you_are = {
text = "Of course you are. Sooner or later, everyone comes to see me. Want a cookie?",
options = {
{label = "Yes, please.", next_node = "cookie"},
{label = "I'm good.", next_node = "no_cookie"}
}
},
cookie = {
text = "Here you go. Now, what's really on your mind?",
options = {
{label = "Am I The One?", next_node = "the_one"},
{label = "What is the Matrix?", next_node = "the_matrix"}
}
},
no_cookie = {
text = "Suit yourself. Now, what's troubling you?",
options = {
{label = "Am I The One?", next_node = "the_one"},
{label = "What is the Matrix?", next_node = "the_matrix"}
}
},
the_one = {
text = "Being The One is just like being in love. No one can tell you you're in love, you just know it. Through and through. Balls to bones.",
options = {
{label = "So I'm not?", next_node = "dialog_end"}
}
},
the_matrix = {
text = "The Matrix is a system, Neo. That system is our enemy. But when you're inside, you look around, what do you see? The very minds of the people we are trying to save.",
options = {
{label = "I see.", next_node = "dialog_end"}
}
},
dialog_end = {
text = "You have to understand, most of these people are not ready to be unplugged.",
options = {}
}
}
},
},
items = {
{
name = "Key",
@@ -193,102 +62,6 @@ local function get_initial_data()
{
-- Screen 2
name = "Screen 2",
npcs = {
{
name = "Rhythm Master",
sprite_id = 4,
dialog = {
start = {
text = "Test your timing! Hit the mark when the moment is right.",
options = {
{label = "Let's go!", next_node = "__MINIGAME_RHYTHM__"},
{label = "Not now.", next_node = "dialog_end"}
}
},
dialog_end = {
text = "Come back when you're ready to test your reflexes.",
options = {}
}
}
},
{
name = "Morpheus",
sprite_id = 5,
dialog = {
start = {
text = "At last. Welcome, Neo. As you no doubt have guessed, I am Morpheus.",
options = {
{label = "It's an honor to meet you.", next_node = "honor"},
{label = "You've been looking for me.", next_node = "looking_for_me"}
}
},
honor = {
text = "No, the honor is mine.",
options = {
{label = "What is this place?", next_node = "what_is_this_place"}
}
},
looking_for_me = {
text = "I have. For some time.",
options = {
{label = "What is this place?", next_node = "what_is_this_place"}
}
},
what_is_this_place = {
text = "This is the construct. It's our loading program. We can load anything from clothing, to equipment, weapons, training simulations. Anything we need.",
options = {
{label = "Right.", next_node = "dialog_end"}
}
},
dialog_end = {
text = "I've been waiting for you, Neo. We have much to discuss.",
options = {} -- Ends conversation
}
}
},
{
name = "Tank",
sprite_id = 6,
dialog = {
start = {
text = "Hey, Neo! Welcome to the construct. I'm Tank.",
options = {
{label = "Good to meet you.", next_node = "good_to_meet_you"},
{label = "This place is incredible.", next_node = "incredible"}
}
},
good_to_meet_you = {
text = "You too! We've been waiting for you. Need anything? Training? Weapons?",
options = {
{label = "Training?", next_node = "training"},
{label = "I'm good for now.", next_node = "dialog_end"}
}
},
incredible = {
text = "Isn't it? The boss's design. We can load anything we need. What do you want to learn?",
options = {
{label = "Show me.", next_node = "training"}
}
},
training = {
text = "Jujitsu? Kung Fu? How about... all of them?",
options = {
{label = "All of them.", next_node = "all_of_them"}
}
},
all_of_them = {
text = "Operator, load the combat training program.",
options = {
{label = "...", next_node = "dialog_end"}
}
},
dialog_end = {
text = "Just holler if you need anything. Anything at all.",
options = {}
}
}
}
},
items = {
{
name = "Potion",
@@ -300,134 +73,6 @@ local function get_initial_data()
{
-- Screen 3
name = "Screen 3",
npcs = {
{
name = "DDR Rhythm Master",
sprite_id = 4,
dialog = {
start = {
text = "Test your reflexes! Hit the arrows in time with the music. Choose your difficulty:",
options = {
{label = "Test Song", next_node = "test"},
{label = "Test Song 2", next_node = "test_2"},
{label = "Random Mode", next_node = "random"},
{label = "Not now.", next_node = "dialog_end"}
}
},
test = {
text = "Test song selected. Show me what you got!",
options = {
{label = "Start!", next_node = "__MINIGAME_DDR:test_song__"}
}
},
test_2 = {
text = "Test song 2 selected. Show me what you got!",
options = {
{label = "Start!", next_node = "__MINIGAME_DDR:test_song_2__"}
}
},
random = {
text = "Random arrows! No pattern, just react!",
options = {
{label = "Start!", next_node = "__MINIGAME_DDR__"}
}
},
dialog_end = {
text = "Come back when you're ready to dance!",
options = {}
}
}
},
{
name = "Agent Smith",
sprite_id = 8,
dialog = {
start = {
text = "Mr. Anderson. We've been expecting you.",
options = {
{label = "My name is Neo.", next_node = "name_is_neo"},
{label = "...", next_node = "silent"}
}
},
name_is_neo = {
text = "Whatever you say. You're here for a reason.",
options = {
{label = "What reason?", next_node = "what_reason"}
}
},
silent = {
text = "The silent type. It doesn't matter. You are an anomaly.",
options = {
{label = "What do you want?", next_node = "what_reason"}
}
},
what_reason = {
text = "To be deleted. The system has no place for your kind.",
options = {
{label = "I won't let you.", next_node = "wont_let_you"}
}
},
wont_let_you = {
text = "You hear that, Mr. Anderson? That is the sound of inevitability.",
options = {
{label = "...", next_node = "dialog_end"}
}
},
dialog_end = {
text = "It is purpose that created us. Purpose that connects us. Purpose that pulls us. That guides us. That drives us. It is purpose that defines. Purpose that binds us.",
options = {}
}
}
},
{
name = "Cypher",
sprite_id = 9,
dialog = {
start = {
text = "Well, well. The new messiah. Welcome to the real world.",
options = {
{label = "You don't seem happy.", next_node = "not_happy"},
{label = "...", next_node = "silent"}
}
},
not_happy = {
text = "Happy? Ignorance is bliss, Neo. We've been fighting this war for years. For what?",
options = {
{label = "For freedom.", next_node = "freedom"}
}
},
silent = {
text = "Not a talker, huh? Smart. Less to regret later. Want a drink?",
options = {
{label = "Sure.", next_node = "drink"},
{label = "No thanks.", next_node = "no_drink"}
}
},
drink = {
text = "Good stuff. The little things you miss, you know? Like a good steak.",
options = {
{label = "I guess.", next_node = "dialog_end"}
}
},
no_drink = {
text = "Your loss. More for me.",
options = {
{label = "...", next_node = "dialog_end"}
}
},
freedom = {
text = "Freedom... right. If Morpheus told you you could fly, would you believe him?",
options = {
{label = "He's our leader.", next_node = "dialog_end"}
}
},
dialog_end = {
text = "Just be careful who you trust.",
options = {}
}
}
}
},
items = {}
}
})

View File

@@ -10,10 +10,9 @@ local MinigameRhythmWindow = {}
local MinigameDDRWindow = {}
local Util = {}
local Actions = {}
local UI = {}
local Print = {}
local Input = {}
local NPC = {}
local Item = {}
local Player = {}
local Audio = {}
local Audio = {}local Audio = {}

View File

@@ -0,0 +1,31 @@
Actions = {}
function Actions.start_dialog(dialog_data, active_entity_name, start_node)
-- This function will handle initiating a dialog.
-- It needs access to the full dialog structure, the entity that owns it (for display), and the starting node.
-- The active_entity_name is just for display purposes; the full dialog_data should contain all nodes.
-- Create a dummy entity for PopupWindow.show_menu_dialog (which expects an entity)
local dummy_entity = { name = active_entity_name, dialog = dialog_data }
-- This is a temporary solution. The final refactor will remove show_menu_dialog.
-- For now, we'll mimic the old behavior as much as possible for dialogs.
Context.dialog.active_entity = dummy_entity
PopupWindow.set_dialog_node(start_node)
end
function Actions.start_minigame_mash()
MinigameButtonMashWindow.start(WINDOW_GAME)
end
function Actions.start_minigame_rhythm()
MinigameRhythmWindow.start(WINDOW_GAME)
end
function Actions.start_minigame_ddr(song_key)
MinigameDDRWindow.start(WINDOW_GAME, song_key)
end
function Actions.examine_item(item_data)
PopupWindow.show_description_dialog(item_data, item_data.desc)
end

View File

@@ -1,5 +1,13 @@
Util = {}
function Util.create_decision(id, label, handler)
return {
id = id,
label = label,
handler = handler
}
end
function Util.safeindex(array, index)
return ((index - 1 + #array) % #array) + 1
end

View File

@@ -17,21 +17,6 @@ function GameWindow.update()
Context.current_screen = Context.current_screen + 1
end
end
if Input.player_interact() then
-- Get the current screen's NPCs
local currentScreenData = Context.screens[Context.current_screen]
if currentScreenData and currentScreenData.npcs and #currentScreenData.npcs > 0 then
-- For now, interact with the first NPC on the screen
-- TODO: Add proximity detection to find nearest NPC
local npc = currentScreenData.npcs[1]
PopupWindow.show_menu_dialog(npc, {
{label = "Talk to", action = NPC.talk_to},
{label = "Fight", action = NPC.fight},
{label = "Go back", action = NPC.go_back}
}, WINDOW_POPUP)
end
end
end
function GameWindow.set_state(new_state)