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

WIP: Add lombok dependency + start refactoring components #394

Open
wants to merge 1 commit into
base: desarrollo-v0.2.0
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ dependencies {
}
implementation group: 'net.mostlyoriginal.artemis-odb', name: 'contrib-plugin-profiler', version: '2.5.0'
implementation group: "org.reflections", name: "reflections", version: "$reflectionsVersion"

compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'

testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
}
6 changes: 6 additions & 0 deletions components/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ sourceSets.main.java.srcDirs = ["src/"]
dependencies {
api group: "com.badlogicgames.gdx", name: "gdx", version: "$gdxVersion"
api group: "net.onedaybeard.artemis", name: "artemis-odb", version: "$artemisVersion"

compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'

testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
}
19 changes: 8 additions & 11 deletions components/src/component/entity/Clear.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package component.entity;

import com.artemis.Component;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
* Componente para la limpieza automática de entidades por timeout.
Expand All @@ -10,18 +13,12 @@
* @todo ¿son necesarios los getters/setters?
* @todo Evaluar unificar los sistemas de limpieza en cliente y servidor.
*/
public class Clear extends Component {

float time;

public Clear() {
}
@Getter
@Setter
@NoArgsConstructor
public class Clear extends Component {

public float getTime() {
return time;
}
private float time;

public void setTime(float time) {
this.time = time;
}
}
11 changes: 4 additions & 7 deletions components/src/component/entity/Description.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

import com.artemis.Component;
import com.artemis.annotations.PooledWeaver;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@PooledWeaver
@NoArgsConstructor
@AllArgsConstructor
public class Description extends Component implements Serializable {

public String text;

public Description() {
}

public Description(String desc) {
this.text = desc;
}

}
22 changes: 8 additions & 14 deletions components/src/component/entity/Ref.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
package component.entity;

import com.artemis.Component;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class Ref extends Component {
private int id;

public Ref() {
}

public Ref(int id) {
this.id = id;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}
}
5 changes: 3 additions & 2 deletions components/src/component/entity/character/Character.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import com.artemis.Component;
import com.artemis.annotations.PooledWeaver;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@PooledWeaver
@NoArgsConstructor
public class Character extends Component implements Serializable {
public Character() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import com.artemis.Component;
import com.artemis.annotations.PooledWeaver;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@PooledWeaver
@NoArgsConstructor
public class Criminal extends Component implements Serializable {

public Criminal() {
}

}
4 changes: 2 additions & 2 deletions components/src/component/entity/character/status/GM.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import com.artemis.Component;
import com.artemis.annotations.PooledWeaver;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@PooledWeaver
@NoArgsConstructor
public class GM extends Component implements Serializable {
public GM() {
}

}
24 changes: 9 additions & 15 deletions components/src/component/entity/combat/AttackPower.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@

import com.artemis.Component;
import com.artemis.annotations.PooledWeaver;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

@PooledWeaver
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class AttackPower extends Component implements Serializable {

public int value;
private int value;

public AttackPower() {
}

public AttackPower(int value) {
this.value = value;
}

public int getValue() {
return value;
}

public void setValue(int value) {
this.value = value;
}
}
22 changes: 8 additions & 14 deletions components/src/component/entity/combat/EvasionPower.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@

import com.artemis.Component;
import com.artemis.annotations.PooledWeaver;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

@PooledWeaver
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class EvasionPower extends Component implements Serializable {

public int value;

public EvasionPower() {
}

public EvasionPower(int value) {
this.value = value;
}

public int getValue() {
return value;
}

public void setValue(int value) {
this.value = value;
}
}
24 changes: 9 additions & 15 deletions components/src/component/entity/npc/NPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@

import com.artemis.Component;
import com.artemis.annotations.PooledWeaver;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

@PooledWeaver
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class NPC extends Component implements Serializable {

public int id;
private int id;

public NPC() {
}

public NPC(int id) {
this.id = id;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}
}
42 changes: 6 additions & 36 deletions components/src/component/entity/npc/OriginPos.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
import com.artemis.Component;
import com.artemis.annotations.PooledWeaver;
import component.position.WorldPos;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

@PooledWeaver
@Getter
@Setter
@AllArgsConstructor
public class OriginPos extends Component {

public int map;
Expand All @@ -19,48 +25,12 @@ public OriginPos() {
this.map = 0;
}

public OriginPos(int x, int y) {
this.x = x;
this.y = y;
this.map = 1; // wrong
}

public OriginPos(int x, int y, int map) {
this.x = x;
this.y = y;
this.map = map;
}

public OriginPos(OriginPos pos) {
this.x = pos.x;
this.y = pos.y;
this.map = pos.map;
}

public int getMap() {
return map;
}

public void setMap(int map) {
this.map = map;
}

public int getX() {
return x;
}

public void setX(int x) {
this.x = x;
}

public int getY() {
return y;
}

public void setY(int y) {
this.y = y;
}

public WorldPos toWorldPos() {
return new WorldPos(x, y, map);
}
Expand Down
42 changes: 9 additions & 33 deletions components/src/component/entity/npc/Respawn.java
Original file line number Diff line number Diff line change
@@ -1,47 +1,23 @@
package component.entity.npc;

import com.artemis.Component;
import com.artemis.annotations.All;
import com.artemis.annotations.PooledWeaver;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

@PooledWeaver
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Respawn extends Component implements Serializable {

private float time;
private int npcId;
private OriginPos pos;

public Respawn() {
}

public Respawn(float time, int npcId, OriginPos pos) {
this.time = time;
this.npcId = npcId;
this.pos = pos;
}

public float getTime() {
return time;
}

public void setTime(float time) {
this.time = time;
}

public int getNpcId() {
return npcId;
}

public void setNpcId(int npcId) {
this.npcId = npcId;
}

public OriginPos getPos() {
return pos;
}

public void setPos(OriginPos pos) {
this.pos = pos;
}
}
Loading