Disabled Player-Player and Player-Drone collisions

This commit is contained in:
Anuken
2019-10-01 20:28:40 -04:00
parent cb929a7239
commit 8ccdba5be2
4 changed files with 42 additions and 8 deletions

View File

@@ -1315,7 +1315,8 @@ public class Blocks implements ContentList{
requirements(Category.turret, ItemStack.with(Items.copper, 85, Items.lead, 45));
ammo(
Items.scrap, Bullets.flakScrap,
Items.lead, Bullets.flakLead
Items.lead, Bullets.flakLead,
Items.metaglass, Bullets.flakGlass
);
reload = 18f;
range = 170f;
@@ -1558,6 +1559,7 @@ public class Blocks implements ContentList{
cyclone = new ItemTurret("cyclone"){{
requirements(Category.turret, ItemStack.with(Items.copper, 200, Items.titanium, 125, Items.plastanium, 80));
ammo(
Items.metaglass, Bullets.flakGlass,
Items.blastCompound, Bullets.flakExplosive,
Items.plastanium, Bullets.flakPlastic,
Items.surgealloy, Bullets.flakSurge

View File

@@ -21,7 +21,7 @@ public class Bullets implements ContentList{
artilleryDense, arilleryPlastic, artilleryPlasticFrag, artilleryHoming, artlleryIncendiary, artilleryExplosive, artilleryUnit,
//flak
flakScrap, flakLead, flakPlastic, flakExplosive, flakSurge,
flakScrap, flakLead, flakPlastic, flakExplosive, flakSurge, flakGlass, glassFrag,
//missiles
missileExplosive, missileIncendiary, missileSurge, missileJavelin, missileSwarm, missileRevenant,
@@ -55,7 +55,7 @@ public class Bullets implements ContentList{
splashDamage = 33f;
}};
artilleryPlasticFrag = new BasicBulletType(2.5f, 7, "bullet"){{
artilleryPlasticFrag = new BasicBulletType(2.5f, 10, "bullet"){{
bulletWidth = 10f;
bulletHeight = 12f;
bulletShrink = 1f;
@@ -132,6 +132,16 @@ public class Bullets implements ContentList{
frontColor = Pal.bulletYellow;
}};
glassFrag = new BasicBulletType(3f, 6, "bullet"){{
bulletWidth = 5f;
bulletHeight = 12f;
bulletShrink = 1f;
lifetime = 20f;
backColor = Pal.gray;
frontColor = Color.white;
despawnEffect = Fx.none;
}};
flakLead = new FlakBulletType(4.2f, 3){{
lifetime = 60f;
ammoMultiplier = 4f;
@@ -155,8 +165,23 @@ public class Bullets implements ContentList{
splashDamageRadius = 24f;
}};
flakGlass = new FlakBulletType(4f, 3){{
lifetime = 70f;
ammoMultiplier = 5f;
shootEffect = Fx.shootSmall;
reloadMultiplier = 0.8f;
bulletWidth = 6f;
bulletHeight = 8f;
hitEffect = Fx.flakExplosion;
splashDamage = 30f;
splashDamageRadius = 26f;
fragBullet = glassFrag;
fragBullets = 6;
}};
flakPlastic = new FlakBulletType(4f, 6){{
splashDamageRadius = 50f;
splashDamage = 25f;
fragBullet = artilleryPlasticFrag;
fragBullets = 6;
hitEffect = Fx.plasticExplosion;

View File

@@ -216,10 +216,14 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
float cx = x - fsize/2f, cy = y - fsize/2f;
for(Team team : Team.all){
avoid(unitGroups[team.ordinal()].intersect(cx, cy, fsize, fsize));
if(team != getTeam() || !(this instanceof Player)){
avoid(unitGroups[team.ordinal()].intersect(cx, cy, fsize, fsize));
}
}
avoid(playerGroup.intersect(cx, cy, fsize, fsize));
if(!(this instanceof Player)){
avoid(playerGroup.intersect(cx, cy, fsize, fsize));
}
velocity.add(moveVector.x / mass() * Time.delta(), moveVector.y / mass() * Time.delta());
}
@@ -227,15 +231,14 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
float radScl = 1.5f;
for(Unit en : arr){
if(en.isFlying() != isFlying()) continue;
if(en.isFlying() != isFlying() || (en instanceof Player && en.getTeam() != getTeam())) continue;
float dst = dst(en);
float scl = Mathf.clamp(1f - dst / (getSize()/(radScl*2f) + en.getSize()/(radScl*2f)));
moveVector.add(Tmp.v1.set((x - en.x) * scl, (y - en.y) * scl).limit(0.4f));
}
}
public @Nullable
TileEntity getClosestCore(){
public @Nullable TileEntity getClosestCore(){
TeamData data = state.teams.get(team);
Tile tile = Geometry.findClosest(x, y, data.cores);

View File

@@ -1,12 +1,16 @@
package io.anuke.mindustry.game;
import io.anuke.arc.util.ArcAnnotate.*;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.mod.Mods.*;
import io.anuke.mindustry.type.ContentType;
/** Base class for a content type that is loaded in {@link io.anuke.mindustry.core.ContentLoader}. */
public abstract class Content{
public final short id;
/** The mod that loaded this piece of content. */
public @Nullable LoadedMod mod;
public Content(){
this.id = (short)Vars.content.getBy(getContentType()).size;