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

Change fuel to accept any "torch" #32

Merged
merged 2 commits into from
Oct 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public class HooverCartAction extends BaseComponentSystem implements UpdateSubsc
@In
Physics physics;

private boolean isTorch(BlockItemComponent blockItem) {
return blockItem.blockFamily.getURI().toString().toLowerCase().endsWith("torch");
}

@Override
public void update(float delta) {
for (EntityRef entity : entityManager.getEntitiesWith(HooverCartComponent.class, InventoryComponent.class, LocationComponent.class)) {
Expand All @@ -55,7 +59,7 @@ public void update(float delta) {
ItemComponent itemComponent = fuelSlot.getComponent(ItemComponent.class);
BlockItemComponent biComponent = fuelSlot.getComponent(BlockItemComponent.class);
//add 5 energy units for 1 torch
if (biComponent.blockFamily.getURI().toString().equalsIgnoreCase("core:torch")) {
if (isTorch(biComponent)) {
while (itemComponent.stackCount > 0) {
itemComponent.stackCount--;
hcComponent.energy += 5;
Expand Down