feat: integrate inventory with cursor system, scene input, and GameScript

- ActionState: add ITEM action (value 4) to enum and get_action_name()
- MainGame: right-click cycles through all 5 actions including ITEM;
  skips ITEM if nothing selected; clears selection when cycling away
- Scene: guard _unhandled_input() against active inventory overlay;
  handle ITEM action for world-wide item use; add give_item(),
  remove_item(), strip_items() helper methods
- SetPiece: handle ITEM action by calling scene's _use_item_on_setpiece()
- GameScript: add GiveItem and GiveItemDeferred script step classes
  for item acquisition during cutscenes
This commit is contained in:
2026-04-26 21:10:39 -07:00
parent afcf92dbfd
commit fb8798a4ae
5 changed files with 114 additions and 4 deletions

View File

@@ -476,5 +476,54 @@ func switch_camera(path):
func reset_camera():
var thing = ResetCamera.new()
return thing
class GiveItem:
extends ScriptNode
var item_id: String = ""
var text: String = ""
var subject: Node2D = null
var done = false
var started = false
func step_type():
return "GiveItem " + item_id
func init(scene):
super(scene)
func do(delta):
if not started:
started = true
if text:
await scene.find_child("dialogue").say(text)
InventoryManager.acquire_item(item_id)
done = true
func is_done():
return done
func interrupt():
done = true
class GiveItemDeferred:
extends GiveItem
var subject_name: String = ""
func init(scene):
super(scene)
subject = scene.get_node(subject_name)
func give_item(item_id: String, text: String = ""):
var step = GiveItem.new()
step.item_id = item_id
step.text = text
return step
func give_item_deferred(item_id: String, subject_name: String, text: String = ""):
var step = GiveItemDeferred.new()
step.item_id = item_id
step.subject_name = subject_name
step.text = text
return step
var current_script : ScriptGraph = null