Implement scrap pile selection
Scrap piles become a third selection category: click to select (actors win on overlap), box-drag / Ctrl+click multi-select, and the selected- object panel shows the summed remaining amount, updating live and dropping piles as they are collected or despawn. - ScrapSystem: expose per-pile amount via ScrapInfo. - EntityHitTest: add scrapAtWorldPos and scrapInBox (with tests). - New header-only ScrapSelectionChangedEvent. - GameWorldView: scrap selection member, click/box handling with the building-wins disambiguation, and per-frame pruning of gone piles. - SelectedBuildingPanel: scrap event, "Scrap: N" label, live total; scrap and building/entity selections clear each other. Implements REQ-UI-SCRAP-CLICK-SELECT, REQ-UI-SCRAP-MULTI-SELECT, REQ-UI-SCRAP-PANEL. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DZR44tA8sn4dPqDzAVXyps
This commit is contained in:
18
src/lib/eventsystem/event/ScrapSelectionChangedEvent.h
Normal file
18
src/lib/eventsystem/event/ScrapSelectionChangedEvent.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "entt/entity/entity.hpp"
|
||||
|
||||
#include "Event.h"
|
||||
|
||||
// The set of currently selected scrap piles (REQ-UI-SCRAP-CLICK-SELECT,
|
||||
// REQ-UI-SCRAP-MULTI-SELECT). An empty list means no scrap is selected. Scrap forms
|
||||
// its own selection category, mutually exclusive with buildings and entities.
|
||||
class ScrapSelectionChangedEvent : public Event
|
||||
{
|
||||
public:
|
||||
explicit ScrapSelectionChangedEvent(std::vector<entt::entity> scrap)
|
||||
: scrap(std::move(scrap)) {}
|
||||
const std::vector<entt::entity> scrap;
|
||||
};
|
||||
Reference in New Issue
Block a user