feat: Add objectives system with policy methods and test scenarios

This commit is contained in:
Z. Cliffe Schreuders
2025-11-26 09:43:06 +00:00
parent 9d6d7709c3
commit 412cebb65c
5 changed files with 170 additions and 3 deletions

View File

@@ -37,6 +37,18 @@ module BreakEscape
show?
end
def objectives?
show?
end
def complete_task?
show?
end
def update_task_progress?
show?
end
class Scope < Scope
def resolve
if user&.admin? || user&.account_manager?

View File

@@ -5,7 +5,7 @@
.objectives-panel {
position: fixed;
top: 20px;
right: 20px;
left: 20px;
width: 280px;
max-height: 60vh;
background: rgba(0, 0, 0, 0.85);
@@ -106,9 +106,11 @@
.aim-completed .aim-header {
color: #4ade80;
text-decoration: line-through;
opacity: 0.7;
}
.aim-completed .aim-title {
text-decoration: line-through;
}
.aim-icon {
font-size: 12px;
@@ -137,9 +139,11 @@
.task-completed {
color: #4ade80;
text-decoration: line-through;
opacity: 0.6;
}
.task-completed .task-title {
text-decoration: line-through;
}
.task-icon {
font-size: 10px;

View File

@@ -0,0 +1,151 @@
{
"scenario_brief": "Test scenario for the Objectives System. Demonstrates all task types: collect items, unlock rooms, unlock objects, enter rooms, and NPC conversations.",
"endGoal": "Complete all objectives to test the system",
"version": "1.0",
"startRoom": "reception",
"objectives": [
{
"aimId": "tutorial",
"title": "Complete the Tutorial",
"description": "Learn how to use the objectives system",
"status": "active",
"order": 0,
"tasks": [
{
"taskId": "explore_reception",
"title": "Explore the reception area",
"type": "enter_room",
"targetRoom": "reception",
"status": "active"
},
{
"taskId": "collect_documents",
"title": "Collect classified documents",
"type": "collect_items",
"targetItems": ["document"],
"targetCount": 2,
"currentCount": 0,
"status": "active",
"showProgress": true
}
]
},
{
"aimId": "gain_access",
"title": "Gain Access to Secure Areas",
"description": "Unlock doors and access restricted zones",
"status": "active",
"order": 1,
"tasks": [
{
"taskId": "unlock_office",
"title": "Unlock the office door",
"type": "unlock_room",
"targetRoom": "office1",
"status": "active",
"onComplete": {
"unlockTask": "enter_office"
}
},
{
"taskId": "enter_office",
"title": "Enter the office",
"type": "enter_room",
"targetRoom": "office1",
"status": "locked"
}
]
},
{
"aimId": "find_intel",
"title": "Find Hidden Intel",
"status": "locked",
"unlockCondition": { "aimCompleted": "gain_access" },
"order": 2,
"tasks": [
{
"taskId": "unlock_safe",
"title": "Crack the safe",
"type": "unlock_object",
"targetObject": "office_safe",
"status": "active"
},
{
"taskId": "collect_key",
"title": "Find the key",
"type": "collect_items",
"targetItems": ["key"],
"targetCount": 1,
"currentCount": 0,
"status": "active",
"showProgress": true
}
]
}
],
"globalVariables": {
"tutorial_complete": false
},
"rooms": {
"reception": {
"type": "office-reception",
"connections": {
"north": "office1"
},
"objects": [
{
"type": "document",
"name": "Classified Report A",
"x": 5,
"y": 5,
"takeable": true,
"interactable": true,
"active": true,
"observations": "A classified document marked TOP SECRET"
},
{
"type": "document",
"name": "Classified Report B",
"x": 7,
"y": 5,
"takeable": true,
"interactable": true,
"active": true,
"observations": "Another classified document"
}
]
},
"office1": {
"type": "office-generic",
"locked": true,
"lockType": "pin",
"requires": "1234",
"connections": {
"south": "reception"
},
"objects": [
{
"type": "safe",
"name": "office_safe",
"x": 3,
"y": 3,
"takeable": false,
"interactable": true,
"active": true,
"locked": true,
"lockType": "pin",
"requires": "0000",
"observations": "A heavy duty safe",
"contents": [
{
"type": "key",
"name": "Master Key",
"takeable": true,
"observations": "An important key"
}
]
}
]
}
}
}