Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

organize under single inventory package #37

Open
keturn opened this issue Mar 11, 2021 · 3 comments
Open

organize under single inventory package #37

keturn opened this issue Mar 11, 2021 · 3 comments

Comments

@keturn
Copy link
Contributor

keturn commented Mar 11, 2021

Similar to Terasology/Health#71

The package names currently used in this module make it difficult to distinguish which classes are in this module and which are from engine or elsewhere.

Recommend all packages here descend from a single org.terasology.inventory (or org.terasology.module.inventory?) instead of org.terasology.logic & rendering.

I'm singling some of these out not just because they're not under a single package, but also because health and inventory packages still exist in engine, making things extra muddled.

@keturn
Copy link
Contributor Author

keturn commented Mar 11, 2021

This is the current package organization under org.terasology, with some classes elided for brevity:

terasology
├── input
│   └── binds
│       └── inventory
│           ├── DropItemButton.java
│           ├── InventoryButton.java
│           ├── ToolbarNextButton.java [ … ]
│           └── ToolbarSlotButton.java
├── logic
│   └── inventory
│       ├── action
│       │   ├── GiveItemAction.java
│       │   ├── MoveItemAction.java
│       │   ├── RemoveItemAction.java
│       │   └── SwitchItemAction.java
│       ├── block
│       │   ├── BlockInventorySystem.java
│       │   ├── DropBlockInventoryComponent.java
│       │   └── RetainBlockInventoryComponent.java
│       ├── CharacterInventorySystem.java
│       ├── events
│       │   ├── AbstractMoveItemRequest.java
│       │   ├── BeforeItemPutInInventory.java  [ … ]
│       │   ├── MoveItemRequest.java
│       │   └── MoveItemToSlotsRequest.java
│       ├── InventoryAccessComponent.java
│       ├── InventoryAuthoritySystem.java
│       ├── InventoryClientSystem.java
│       ├── InventoryComponent.java [ … ]
│       └── StartingInventorySystem.java
└── rendering
    └── nui
        └── layers
            ├── hud
            │   ├── DropItemRegion.java
            │   └── InventoryHud.java
            └── ingame
                └── inventory
                    ├── BeforeInventoryCellRendered.java
                    ├── ContainerScreen.java
                    ├── GetItemTooltip.java
                    ├── InventoryCell.java [ … ]
                    └── TransferItemCursor.java

What do we want it to look like instead? The root at org.terasology.module.inventory, and then drop inventory out of the middle layers?

org.terasology.logic.inventory.action.GiveItemAction becomes
org.terasology.module.inventory.logic.action.GiveItemAction

these are getting lengthy. Are there any levels we might collapse while we're at it? (I'm looking at rendering.nui.layers suspiciously.)

@keturn
Copy link
Contributor Author

keturn commented Mar 11, 2021

for modules I'd probably even be okay with dropping the logic and input levels, so

org.terasology.logic.inventory.action.GiveItemAction becomes
org.terasology.module.inventory.action.GiveItemAction

if Component and System classes end up in the org.terasology.module.inventory root because of that, that seems okay to me. Most modules don't declare very many of those, right?

@skaldarnar
Copy link
Contributor

skaldarnar commented Mar 12, 2021

I'd prefer to use terminology from the ECS here (also using plural if this is a package containing multiple different incarnations of systems or events):

  • logic systems
  • action events

I'd flatten rendering.nui.layers.{hud,ingame} to just ui, i.e. org.terasology.module.inventory.ui.

Would this be too flat?

org.terasology.module.inventory
├── input
│   ├── DropItemButton.java
│   ├── InventoryButton.java
│   ├── ToolbarNextButton.java [ … ]
│   └── ToolbarSlotButton.java
├── components
│   ├── DropBlockInventoryComponent.java
│   ├── RetainBlockInventoryComponent.java
│   ├── InventoryAccessComponent.java
│   └── InventoryComponent.java [ … ]
├── events
│   ├── GiveItemAction.java
│   ├── MoveItemAction.java
│   ├── RemoveItemAction.java
│   ├── SwitchItemAction.java
│   ├── AbstractMoveItemRequest.java
│   ├── BeforeItemPutInInventory.java  [ … ]
│   ├── MoveItemRequest.java
│   └── MoveItemToSlotsRequest.java
├── systems
│   ├── BlockInventorySystem.java
│   ├── CharacterInventorySystem.java
│   ├── InventoryAuthoritySystem.java
│   ├── InventoryClientSystem.java
│   └── StartingInventorySystem.java
└── ui
    ├── DropItemRegion.java
    ├── InventoryHud.java
    ├── BeforeInventoryCellRendered.java
    ├── ContainerScreen.java
    ├── GetItemTooltip.java
    ├── InventoryCell.java [ … ]
    └── TransferItemCursor.java

Maybe break up events into sub-pacakges:

├── events
│   ├── BeforeItemPutInInventory.java  [ … ]
│   ├── actions
│   │  ├──GiveItemAction.java
│   │  ├──MoveItemAction.java
│   │  ├── RemoveItemAction.java
│   │  └── SwitchItemAction.java
│   └── requests
│      ├── AbstractMoveItemRequest.java
│      ├── MoveItemRequest.java
│      └── MoveItemToSlotsRequest.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants