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

fix(ecs-gestalt): Migrate Components to gestalt's Components. #14

Merged
merged 3 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
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
@@ -1,27 +1,19 @@
/*
* Copyright 2016 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.equipmentSmithing.component;

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

/**
* Add this Component to any recipe prefab that is supposed to be creatable in a ForgingStation or similar.
* Include in prefab along with CraftingStationRecipeComponent to work properly.
*/
public class ForgingStationRecipeComponent implements Component {
public class ForgingStationRecipeComponent implements Component<ForgingStationRecipeComponent> {
// The following variables are unused.
public String recipeId;

@Override
public void copyFrom(ForgingStationRecipeComponent other) {
this.recipeId = other.recipeId;
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
/*
* Copyright 2016 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.equipmentSmithing.component;

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

public class RuneComponent implements Component {
public class RuneComponent implements Component<RuneComponent> {
@Replicate
public String runeID;

@Replicate
public int tier = 1;

@Override
public void copyFrom(RuneComponent other) {
this.runeID = other.runeID;
this.tier = other.tier;
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
/*
* Copyright 2016 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.equipmentSmithing.component;

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

/**
* Note that these modifiers are additive.
*/
public class RuneEquipmentEffectComponent implements Component {
public class RuneEquipmentEffectComponent implements Component<RuneEquipmentEffectComponent> {
/**
* This stores this particular modifier's ID. Each modifier is normally intended to have a different ID, barring
* the scenario where certain effects can replace older ones.
*/
@Replicate
public String id = "No Effect";

@Override
public void copyFrom(RuneEquipmentEffectComponent other) {
this.id = other.id;
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
/*
* Copyright 2016 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.equipmentSmithing.component;

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

/**
* Note that these modifiers are additive.
*/
public class RuneEquipmentModifierComponent implements Component {
public class RuneEquipmentModifierComponent implements Component<RuneEquipmentModifierComponent> {
@Replicate
public int attack = 0;

Expand All @@ -33,4 +20,12 @@ public class RuneEquipmentModifierComponent implements Component {

@Replicate
public int speed = 0;

@Override
public void copyFrom(RuneEquipmentModifierComponent other) {
this.attack = other.attack;
this.defense = other.defense;
this.weight = other.weight;
this.speed = other.speed;
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
/*
* Copyright 2016 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.equipmentSmithing.component;

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

public class RuneEssenceComponent implements Component {
public class RuneEssenceComponent implements Component<RuneEssenceComponent> {
@Replicate
public String runeEssenceID;

@Replicate
public int tier = 1;

@Override
public void copyFrom(RuneEssenceComponent other) {
this.runeEssenceID = other.runeEssenceID;
this.tier = other.tier;
}
}
Original file line number Diff line number Diff line change
@@ -1,59 +1,72 @@
/*
* Copyright 2016 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.equipmentSmithing.component;

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

/**
* Note that these modifiers are additive.
*/
public class RunePhysicalModifierComponent implements Component {
public class RunePhysicalModifierComponent implements Component<RunePhysicalModifierComponent> {
/**
* This stores this particular modifier's ID. Each modifier is normally intended to have a different ID, barring
* the scenario where certain effects can replace older ones.
* This stores this particular modifier's ID. Each modifier is normally intended to have a different ID, barring the scenario where
* certain effects can replace older ones.
*/
@Replicate
public String id = "No Effect";

/** The strength stat affects how much physical damage an entity does upon striking a target. */
/**
* The strength stat affects how much physical damage an entity does upon striking a target.
*/
@Replicate
public int strength = 0;

/** The dexterity stat will affect weapon accuracy and item use speed in the future. */
/**
* The dexterity stat will affect weapon accuracy and item use speed in the future.
*/
@Replicate
public int dexterity = 0;

/** The constitution stat affects player health. */
/**
* The constitution stat affects player health.
*/
@Replicate
public int constitution = 0;

/** The agility stat affects player movement speed. */
/**
* The agility stat affects player movement speed.
*/
@Replicate
public int agility = 0;

/** The endurance stat will affect something in the future. */
/**
* The endurance stat will affect something in the future.
*/
@Replicate
public int endurance = 0;

/** The charisma stat will affect NPC interactions and shopping in the future. */
/**
* The charisma stat will affect NPC interactions and shopping in the future.
*/
@Replicate
public int charisma = 0;

/** The luck stat will provide benefits to many different actions in the future. */
/**
* The luck stat will provide benefits to many different actions in the future.
*/
@Replicate
public int luck = 0;

@Override
public void copyFrom(RunePhysicalModifierComponent other) {
this.id = other.id;
this.strength = other.strength;
this.dexterity = other.dexterity;
this.constitution = other.constitution;
this.agility = other.agility;
this.endurance = other.endurance;
this.charisma = other.charisma;
this.luck = other.luck;
}
}