a performance disaster, part 1
This commit is contained in:
@@ -15,11 +15,16 @@ class AllDefs{
|
||||
|
||||
}
|
||||
|
||||
@GroupDef(value = Bulletc.class, spatial = true, collide = {gunit.class})
|
||||
@GroupDef(value = Bulletc.class, spatial = true)
|
||||
class gbullet{
|
||||
|
||||
}
|
||||
|
||||
@GroupDef(value = Collisionc.class)
|
||||
class gcollision{
|
||||
|
||||
}
|
||||
|
||||
@GroupDef(value = Unitc.class, spatial = true, mapping = true)
|
||||
class gunit{
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public class EntityCollisions{
|
||||
|
||||
group.each(s -> {
|
||||
s.updateLastPosition();
|
||||
tree.insert(s);
|
||||
//tree.insert(s);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import static mindustry.Vars.*;
|
||||
|
||||
@EntityDef(value = {Bulletc.class}, pooled = true)
|
||||
@Component
|
||||
abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Drawc, Shielderc, Ownerc, Velc, Bulletc, Timerc{
|
||||
abstract class BulletComp implements Timedc, Damagec, Collisionc, Teamc, Posc, Drawc, Shielderc, Ownerc, Velc, Bulletc, Timerc{
|
||||
Object data;
|
||||
BulletType type;
|
||||
float damage;
|
||||
|
||||
12
core/src/mindustry/entities/def/CollisionComp.java
Normal file
12
core/src/mindustry/entities/def/CollisionComp.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package mindustry.entities.def;
|
||||
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.async.CollisionProcess.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
/** Can be collided with. Collision elibility depends on team.
|
||||
* TODO merge with hitboxcomp?*/
|
||||
@Component
|
||||
abstract class CollisionComp implements Hitboxc{
|
||||
transient CollisionRef colref;
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package mindustry.entities.def;
|
||||
import arc.math.geom.QuadTree.*;
|
||||
import arc.math.geom.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.async.PhysicsProcess.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@Component
|
||||
@@ -11,7 +10,6 @@ abstract class HitboxComp implements Posc, QuadTreeObject{
|
||||
@Import float x, y;
|
||||
|
||||
transient float lastX, lastY, hitSize;
|
||||
transient PhysicRef body;
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package mindustry.entities.def;
|
||||
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@Component
|
||||
abstract class MassComp implements Velc{
|
||||
transient float mass = 1f;
|
||||
|
||||
public void impulse(float x, float y){
|
||||
vel().add(x / mass, y / mass);
|
||||
}
|
||||
}
|
||||
18
core/src/mindustry/entities/def/PhysicsComp.java
Normal file
18
core/src/mindustry/entities/def/PhysicsComp.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package mindustry.entities.def;
|
||||
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.async.PhysicsProcess.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
/** Affected by physics.
|
||||
* Will bounce off of other objects that are at similar elevations.
|
||||
* Has mass.*/
|
||||
@Component
|
||||
abstract class PhysicsComp implements Velc, Hitboxc, Flyingc{
|
||||
transient PhysicRef physref;
|
||||
transient float mass = 1f;
|
||||
|
||||
public void impulse(float x, float y){
|
||||
vel().add(x / mass, y / mass);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import mindustry.world.blocks.environment.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@Component
|
||||
abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitboxc, Rotc, Massc, Unitc, Weaponsc, Drawc, Boundedc, Syncc, Shieldc{
|
||||
abstract class UnitComp implements Healthc, Physicsc, Collisionc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Boundedc, Syncc, Shieldc{
|
||||
@Import float x, y, rotation, elevation, maxHealth;
|
||||
|
||||
private UnitController controller;
|
||||
|
||||
Reference in New Issue
Block a user