From 8523e5bf6b7d4b88d74808216a616e0abfdb49c7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 2 Oct 2018 18:47:23 -0400 Subject: [PATCH] Rectangles --- build.gradle | 2 +- core/src/io/anuke/mindustry/content/Mechs.java | 7 +++++++ .../src/io/anuke/mindustry/content/UnitTypes.java | 10 ++++++++-- core/src/io/anuke/mindustry/core/Logic.java | 3 ++- core/src/io/anuke/mindustry/entities/Player.java | 2 +- core/src/io/anuke/mindustry/entities/Unit.java | 15 +++++++++++++-- .../mindustry/entities/traits/TargetTrait.java | 7 +++++++ .../anuke/mindustry/entities/units/UnitType.java | 2 +- core/src/io/anuke/mindustry/type/Mech.java | 1 + 9 files changed, 41 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index e7a9c2f0b4..c030f9f3af 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ allprojects { appName = 'Mindustry' gdxVersion = '1.9.8' roboVMVersion = '2.3.0' - uCoreVersion = '1b74e58413f4885f204c441f88464d8c82c5433b' + uCoreVersion = 'ee0de709b7ab7bc993db42436a378ceee88c6460' getVersionString = { String buildVersion = getBuildVersion() diff --git a/core/src/io/anuke/mindustry/content/Mechs.java b/core/src/io/anuke/mindustry/content/Mechs.java index a26d6f16fd..b01c844dad 100644 --- a/core/src/io/anuke/mindustry/content/Mechs.java +++ b/core/src/io/anuke/mindustry/content/Mechs.java @@ -42,6 +42,7 @@ public class Mechs implements ContentList{ { drillPower = 1; mineSpeed = 1.5f; + mass = 1.2f; speed = 0.5f; boostSpeed = 0.85f; weapon = Weapons.blaster; @@ -81,6 +82,7 @@ public class Mechs implements ContentList{ speed = 0.75f; boostSpeed = 0.95f; itemCapacity = 15; + mass = 0.9f; armor = 30f; weaponOffsetX = -1; itemCapacity = 15; @@ -115,6 +117,7 @@ public class Mechs implements ContentList{ itemCapacity = 70; weaponOffsetY = -1; weaponOffsetX = 1; + mass = 1.75f; speed = 0.44f; drag = 0.35f; boostSpeed = 0.8f; @@ -157,6 +160,7 @@ public class Mechs implements ContentList{ itemCapacity = 50; speed = 0.36f; boostSpeed = 0.6f; + mass = 4f; shake = 4f; weaponOffsetX = 1; weaponOffsetY = 0; @@ -233,6 +237,7 @@ public class Mechs implements ContentList{ speed = 0.11f; maxSpeed = 10f; drag = 0.01f; + mass = 2f; armor = 5f; weapon = Weapons.missiles; trailColor = Color.valueOf("d3ddff"); @@ -287,6 +292,7 @@ public class Mechs implements ContentList{ speed = 0.12f; maxSpeed = 10f; drag = 0.035f; + mass = 2.5f; turnCursor = false; armor = 20f; itemCapacity = 30; @@ -309,6 +315,7 @@ public class Mechs implements ContentList{ speed = 0.32f; maxSpeed = 10f; drag = 0.06f; + mass = 3f; armor = 30f; itemCapacity = 60; trailColor = Color.valueOf("feb380"); diff --git a/core/src/io/anuke/mindustry/content/UnitTypes.java b/core/src/io/anuke/mindustry/content/UnitTypes.java index 6bbfca54db..a2b8125d71 100644 --- a/core/src/io/anuke/mindustry/content/UnitTypes.java +++ b/core/src/io/anuke/mindustry/content/UnitTypes.java @@ -48,6 +48,7 @@ public class UnitTypes implements ContentList{ maxVelocity = 1.1f; speed = 0.2f; drag = 0.4f; + mass = 1.75f; range = 40f; weapon = Weapons.chainBlaster; health = 130; @@ -57,7 +58,9 @@ public class UnitTypes implements ContentList{ maxVelocity = 0.8f; speed = 0.18f; drag = 0.4f; + mass = 3f; range = 10f; + hitsize = 8f; rotatespeed = 0.1f; weapon = Weapons.flamethrower; health = 440; @@ -67,7 +70,8 @@ public class UnitTypes implements ContentList{ maxVelocity = 0.8f; speed = 0.15f; drag = 0.4f; - mass = 4f; + mass = 4.5f; + hitsize = 10f; range = 10f; rotatespeed = 0.06f; weaponOffsetX = 1; @@ -89,6 +93,7 @@ public class UnitTypes implements ContentList{ health = 250; speed = 0.2f; maxVelocity = 1.4f; + mass = 3f; drag = 0.01f; isFlying = true; targetAir = false; @@ -97,7 +102,7 @@ public class UnitTypes implements ContentList{ revenant = new UnitType("revenant", Revenant.class, Revenant::new){{ health = 250; - mass = 4f; + mass = 5f; hitsize = 12f; speed = 0.14f; maxVelocity = 1.4f; @@ -109,6 +114,7 @@ public class UnitTypes implements ContentList{ phantom = new UnitType("phantom", Phantom.class, Phantom::new){{ isFlying = true; drag = 0.01f; + mass = 2f; speed = 0.2f; maxVelocity = 0.9f; range = 70f; diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index 355e30987d..fee3dc345d 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -172,12 +172,13 @@ public class Logic extends Module{ EntityQuery.collideGroups(group, playerGroup); for(EntityGroup other : unitGroups){ - if(other == group || other.isEmpty()) continue; + if(other.isEmpty()) continue; EntityQuery.collideGroups(group, other); } } EntityQuery.collideGroups(bulletGroup, playerGroup); + EntityQuery.collideGroups(playerGroup, playerGroup); world.pathfinder().update(); } diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 0ce1564854..f81b6d3428 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -98,7 +98,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra @Override public void getHitbox(Rectangle rectangle){ - rectangle.setSize(5).setCenter(x, y); + rectangle.setSize(mech.hitsize).setCenter(x, y); } @Override diff --git a/core/src/io/anuke/mindustry/entities/Unit.java b/core/src/io/anuke/mindustry/entities/Unit.java index cdfd18c8de..38cc8e3dcc 100644 --- a/core/src/io/anuke/mindustry/entities/Unit.java +++ b/core/src/io/anuke/mindustry/entities/Unit.java @@ -16,6 +16,7 @@ import io.anuke.mindustry.world.blocks.Floor; import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Timers; import io.anuke.ucore.entities.impl.DestructibleEntity; +import io.anuke.ucore.entities.trait.DamageTrait; import io.anuke.ucore.entities.trait.DrawTrait; import io.anuke.ucore.entities.trait.SolidTrait; import io.anuke.ucore.graphics.Draw; @@ -49,6 +50,11 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ protected CarryTrait carrier; protected float drownTime; + @Override + public boolean movable(){ + return true; + } + @Override public UnitInventory getInventory(){ return inventory; @@ -94,8 +100,13 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ @Override public boolean collides(SolidTrait other){ - return true;//other instanceof DamageTrait && other - // instanceof TeamTrait && state.teams.areEnemies((((TeamTrait) other).getTeam()), team) && !isDead(); + if(isDead()) return true; + + if(other instanceof DamageTrait){ + return other instanceof TeamTrait && state.teams.areEnemies((((TeamTrait) other).getTeam()), team); + }else{ + return other instanceof Unit && ((Unit) other).isFlying() == isFlying(); + } } @Override diff --git a/core/src/io/anuke/mindustry/entities/traits/TargetTrait.java b/core/src/io/anuke/mindustry/entities/traits/TargetTrait.java index 80753716c7..bdeea6ea33 100644 --- a/core/src/io/anuke/mindustry/entities/traits/TargetTrait.java +++ b/core/src/io/anuke/mindustry/entities/traits/TargetTrait.java @@ -2,6 +2,7 @@ package io.anuke.mindustry.entities.traits; import io.anuke.mindustry.game.Team; import io.anuke.ucore.entities.trait.PosTrait; +import io.anuke.ucore.entities.trait.SolidTrait; import io.anuke.ucore.entities.trait.VelocityTrait; /** @@ -14,10 +15,16 @@ public interface TargetTrait extends PosTrait, VelocityTrait{ Team getTeam(); default float getTargetVelocityX(){ + if(this instanceof SolidTrait){ + return ((SolidTrait) this).getDeltaX(); + } return getVelocity().x; } default float getTargetVelocityY(){ + if(this instanceof SolidTrait){ + return ((SolidTrait) this).getDeltaY(); + } return getVelocity().y; } diff --git a/core/src/io/anuke/mindustry/entities/units/UnitType.java b/core/src/io/anuke/mindustry/entities/units/UnitType.java index 9703c1759f..6fa0e8627e 100644 --- a/core/src/io/anuke/mindustry/entities/units/UnitType.java +++ b/core/src/io/anuke/mindustry/entities/units/UnitType.java @@ -26,7 +26,7 @@ public class UnitType extends UnlockableContent{ public final String name; public final String description; public float health = 60; - public float hitsize = 5f; + public float hitsize = 7f; public float hitsizeTile = 4f; public float speed = 0.4f; public float range = 160; diff --git a/core/src/io/anuke/mindustry/type/Mech.java b/core/src/io/anuke/mindustry/type/Mech.java index 2d750b1711..d616e02aec 100644 --- a/core/src/io/anuke/mindustry/type/Mech.java +++ b/core/src/io/anuke/mindustry/type/Mech.java @@ -27,6 +27,7 @@ public class Mech extends UnlockableContent{ public float shake = 0f; public float armor = 1f; + public float hitsize = 6f; public float cellTrnsY = 0f; public float mineSpeed = 1f; public int drillPower = -1;