Implement prototype: venue-driven simulation core, scenarios, tests, and playable entrance scene
CI / headless-tests (push) Canceled after 49s
CI / headless-tests (push) Canceled after 49s
- Godot 4.3 project scaffold with first-person guard, procedural world, interaction HUD, access inspection, radio forms, debug overlay, shift review - Simulation core: ShiftCoordinator, VenueScenario, EventScheduler, NPCController/FSM, AccessVerifier, EscalationManager, RadioSystem, IncidentRecorder, ReputationEvaluator, CrowdSystem, EventBus - Three authored scenarios (Hollywood Blvd building, The Joke Shop, TV studio) - Custom headless test runner (25 tests) replacing editor-dependent GUT, plus GitHub Actions CI - Documentation workflow live: README, PLAN (tech stack), TODO/DONE, MEMORY
This commit is contained in:
1 parent
e23f284ad4
commit
439e0a4281
45 files changed
+4368
-7
No files matched your search
@@ -0,0 +1,54 @@
|
||||
class_name ReputationEvaluator
|
||||
extends RefCounted
|
||||
## Evaluates player performance (PLAN.md: Reputation Meter).
|
||||
## Scoring weights are data so they can be tuned per venue.
|
||||
|
||||
const EventBus := preload("res://src/core/event_bus.gd")
|
||||
|
||||
## rating: float starting 50 (out of 100). Errors subtract, though marks add.
|
||||
var rating: float = 70.0
|
||||
var _modifiers: Array[Dictionary] = []
|
||||
var event_bus: EventBus = null
|
||||
|
||||
func set_event_bus(bus: EventBus) -> void:
|
||||
event_bus = bus
|
||||
|
||||
## Apply a reputation change.
|
||||
## category: "peaceful", "force", "false_report", "accuracy", "complaint",
|
||||
## "security_failure", "property_damage", "access_judgment", "crowd"
|
||||
func apply(_category: String, delta: float, reason: String) -> void:
|
||||
# Clamp range: 0..100.
|
||||
var clamped := clampf(rating + delta, 0.0, 100.0)
|
||||
var applied: float = clamped - rating
|
||||
rating = clamped
|
||||
_modifiers.append({
|
||||
"category": _category,
|
||||
"delta": applied,
|
||||
"reason": reason,
|
||||
"at_ms": Time.get_ticks_msec(),
|
||||
})
|
||||
if event_bus:
|
||||
event_bus.reputation_changed.emit({
|
||||
"rating": rating,
|
||||
"delta": applied,
|
||||
"reason": reason,
|
||||
"category": _category,
|
||||
})
|
||||
|
||||
static func grade_for(rating_value: float) -> String:
|
||||
if rating_value >= 90.0:
|
||||
return "A"
|
||||
if rating_value >= 75.0:
|
||||
return "B"
|
||||
if rating_value >= 60.0:
|
||||
return "C"
|
||||
if rating_value >= 40.0:
|
||||
return "D"
|
||||
return "F"
|
||||
|
||||
func summary() -> Dictionary:
|
||||
return {
|
||||
"rating": rating,
|
||||
"grade": grade_for(rating),
|
||||
"modifiers": _modifiers.duplicate(true),
|
||||
}
|
||||
Reference in new issue
Block a user