Skip to content

Commit

Permalink
fix(ecs-gestalt): Migrate Components to gestalt's Components. (#51)
Browse files Browse the repository at this point in the history
Ref: MovingBlocks/Terasology#4753

Co-authored-by: Tobias Nett <skaldarnar@googlemail.com>
  • Loading branch information
DarkWeird and skaldarnar committed Aug 25, 2021
1 parent 846afe8 commit b10038a
Show file tree
Hide file tree
Showing 16 changed files with 106 additions and 108 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.action;

import org.joml.Vector3f;
import org.terasology.additionalRails.components.HooverCartComponent;
import org.terasology.engine.entitySystem.Component;
import org.terasology.engine.entitySystem.entity.EntityManager;
import org.terasology.engine.entitySystem.entity.EntityRef;
import org.terasology.engine.entitySystem.systems.BaseComponentSystem;
import org.terasology.engine.entitySystem.systems.RegisterMode;
import org.terasology.engine.entitySystem.systems.RegisterSystem;
import org.terasology.engine.entitySystem.systems.UpdateSubscriberSystem;
import org.terasology.module.inventory.components.InventoryComponent;
import org.terasology.module.inventory.systems.InventoryManager;
import org.terasology.engine.logic.inventory.ItemComponent;
import org.terasology.engine.logic.inventory.PickupComponent;
import org.terasology.engine.logic.location.LocationComponent;
import org.terasology.engine.physics.Physics;
import org.terasology.engine.physics.StandardCollisionGroup;
import org.terasology.engine.registry.In;
import org.terasology.engine.world.block.items.BlockItemComponent;
import org.terasology.gestalt.entitysystem.component.Component;
import org.terasology.joml.geom.AABBf;
import org.terasology.module.inventory.components.InventoryComponent;
import org.terasology.module.inventory.systems.InventoryManager;

import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

/**
* Component, which differentiates the Activator Rail from others.
* @author Aleksander Wójtowicz <anuar2k@outlook.com>
*/
public class ActivatorRailComponent implements Component {
public class ActivatorRailComponent extends EmptyComponent<ActivatorRailComponent> {
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

public class BoosterRailComponent implements Component {
public class BoosterRailComponent extends EmptyComponent<BoosterRailComponent> {
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.engine.entitySystem.prefab.Prefab;
import org.terasology.gestalt.entitysystem.component.Component;

public class BoreDrillComponent implements Component {
public class BoreDrillComponent implements Component<BoreDrillComponent> {
public Prefab damageType;

@Override
public void copyFrom(BoreDrillComponent other) {
this.damageType = other.damageType;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@

// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.Component;

public class CargoCartComponent implements Component {
public class CargoCartComponent implements Component<CargoCartComponent> {
public int weight = 0;

@Override
public void copyFrom(CargoCartComponent other) {
this.weight = other.weight;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

/**
* Example component differentiating our new cart type from other carts.
* @author Aleksander Wójtowicz <anuar2k@outlook.com>
*/
public class ExampleActivableCartComponent implements Component {
public class ExampleActivableCartComponent extends EmptyComponent<ExampleActivableCartComponent> {
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.Component;

/**
* Component differentiating Explosive Cart.
* @author Aleksander Wójtowicz <anuar2k@outlook.com>
*/
public class ExplosiveCartComponent implements Component {
public class ExplosiveCartComponent implements Component<ExplosiveCartComponent> {
/**
* Defines how long does it take to make the cart explode after being activated by Activator Rail.
*/
public long fuseLengthMs = 4000;

@Override
public void copyFrom(ExplosiveCartComponent other) {
this.fuseLengthMs = other.fuseLengthMs;
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

public class HarvestCartComponent implements Component {
public class HarvestCartComponent extends EmptyComponent<HarvestCartComponent> {
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.Component;

/**
* Component used to differentiate Hoover Cart from other ones.
*/
public class HooverCartComponent implements Component {
public class HooverCartComponent implements Component<HooverCartComponent> {
public int energy = 0;

@Override
public void copyFrom(HooverCartComponent other) {
this.energy = other.energy;
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.Component;

public class LocomotiveComponent implements Component {
public class LocomotiveComponent implements Component<LocomotiveComponent> {
public boolean active = false;

@Override
public void copyFrom(LocomotiveComponent other) {
this.active = other.active;
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

public class OnewayBoosterRailComponent implements Component {
public class OnewayBoosterRailComponent extends EmptyComponent<OnewayBoosterRailComponent> {
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

public class PlantCartComponent implements Component {
public class PlantCartComponent extends EmptyComponent<PlantCartComponent> {
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.engine.world.block.ForceBlockActive;
import org.terasology.gestalt.entitysystem.component.Component;

@ForceBlockActive
public class RailSwitchLeverComponent implements Component {
public class RailSwitchLeverComponent implements Component<RailSwitchLeverComponent> {
/**
* determines if the block is in on or off state
*/
public boolean isOn;

@Override
public void copyFrom(RailSwitchLeverComponent other) {
this.isOn = other.isOn;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.engine.world.block.ForceBlockActive;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

@ForceBlockActive
public class RailSwitchSignalComponent implements Component {
public class RailSwitchSignalComponent extends EmptyComponent<RailSwitchSignalComponent> {
/**
* this component doesn't need to have an isOn boolean field, as information about state is stored in {@link org.terasology.signalling.components.SignalConsumerStatusComponent}
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

/**
* Component differentiating Track Layer Cart from others.
* @author anuar2k
*/
public class TrackLayerCartComponent implements Component {
public class TrackLayerCartComponent extends EmptyComponent<TrackLayerCartComponent> {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0

package org.terasology.additionalRails.components;

import org.terasology.engine.entitySystem.Component;
import org.terasology.gestalt.entitysystem.component.EmptyComponent;

public class TunnelBoreCartComponent implements Component {
public class TunnelBoreCartComponent extends EmptyComponent<TunnelBoreCartComponent> {
}

0 comments on commit b10038a

Please sign in to comment.