Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features
Conflicts: core/assets/logicids.dat core/src/mindustry/content/Blocks.java gradle.properties
This commit is contained in:
@@ -30,8 +30,12 @@ public class Effect{
|
||||
public float lifetime = 50f;
|
||||
/** Clip size. */
|
||||
public float clip;
|
||||
/** Amount added to rotation */
|
||||
public float baseRotation;
|
||||
/** If true, parent unit is data are followed. */
|
||||
public boolean followParent;
|
||||
/** If this and followParent are true, the effect will offset and rotate with the parent's rotation. */
|
||||
public boolean rotWithParent;
|
||||
|
||||
public float layer = Layer.effect;
|
||||
public float layerDuration;
|
||||
@@ -61,11 +65,21 @@ public class Effect{
|
||||
return this;
|
||||
}
|
||||
|
||||
public Effect rotWithParent(boolean follow){
|
||||
rotWithParent = follow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Effect layer(float l){
|
||||
layer = l;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Effect baseRotation(float d){
|
||||
baseRotation = d;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Effect layer(float l, float duration){
|
||||
layer = l;
|
||||
this.layerDuration = duration;
|
||||
@@ -156,12 +170,15 @@ public class Effect{
|
||||
|
||||
EffectState entity = EffectState.create();
|
||||
entity.effect = effect;
|
||||
entity.rotation = rotation;
|
||||
entity.rotation = effect.baseRotation + rotation;
|
||||
entity.data = data;
|
||||
entity.lifetime = effect.lifetime;
|
||||
entity.set(x, y);
|
||||
entity.color.set(color);
|
||||
if(effect.followParent && data instanceof Posc p) entity.parent = p;
|
||||
if(effect.followParent && data instanceof Posc p){
|
||||
entity.parent = p;
|
||||
entity.rotWithParent = effect.rotWithParent;
|
||||
}
|
||||
entity.add();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.entities.abilities;
|
||||
|
||||
import arc.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
@@ -12,6 +13,7 @@ public class StatusFieldAbility extends Ability{
|
||||
public float duration = 60, reload = 100, range = 20;
|
||||
public Effect applyEffect = Fx.none;
|
||||
public Effect activeEffect = Fx.overdriveWave;
|
||||
public float effectX, effectY;
|
||||
public boolean parentizeEffects;
|
||||
|
||||
protected float timer;
|
||||
@@ -40,7 +42,8 @@ public class StatusFieldAbility extends Ability{
|
||||
applyEffect.at(other, parentizeEffects);
|
||||
});
|
||||
|
||||
activeEffect.at(unit, parentizeEffects);
|
||||
float x = unit.x + Angles.trnsx(unit.rotation, effectY, effectX), y = unit.y + Angles.trnsy(unit.rotation, effectY, effectX);
|
||||
activeEffect.at(x, y, unit.rotation, parentizeEffects ? unit : null);
|
||||
|
||||
timer = 0f;
|
||||
}
|
||||
|
||||
@@ -91,6 +91,10 @@ public class BulletType extends Content implements Cloneable{
|
||||
public boolean collidesAir = true, collidesGround = true;
|
||||
/** Whether this bullet types collides with anything at all. */
|
||||
public boolean collides = true;
|
||||
/** If true, this projectile collides with non-surface floors. */
|
||||
public boolean collideFloor = false;
|
||||
/** If true, this projectile collides with static walls */
|
||||
public boolean collideTerrain = false;
|
||||
/** Whether velocity is inherited from the shooter. */
|
||||
public boolean keepVelocity = true;
|
||||
/** Whether to scale lifetime (not actually velocity!) to disappear at the target position. Used for artillery. */
|
||||
|
||||
@@ -1037,7 +1037,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
int amount = Math.min(items.get(item), explosionItemCap());
|
||||
explosiveness += item.explosiveness * amount;
|
||||
flammability += item.flammability * amount;
|
||||
power += item.charge * amount * 100f;
|
||||
power += item.charge * Mathf.pow(amount, 1.1f) * 150f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,15 @@ import arc.math.geom.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.game.Teams.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -137,6 +140,20 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
|
||||
while(x >= 0 && y >= 0 && x < ww && y < wh){
|
||||
Building build = world.build(x, y);
|
||||
|
||||
if(type.collideFloor || type.collideTerrain){
|
||||
Tile tile = world.tile(x, y);
|
||||
if(
|
||||
type.collideFloor && (tile == null || tile.floor().hasSurface() || tile.block() != Blocks.air) ||
|
||||
type.collideTerrain && tile != null && tile.block() instanceof StaticWall
|
||||
){
|
||||
type.despawned(self());
|
||||
remove();
|
||||
hit = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(build != null && isAdded() && build.collide(self()) && type.testCollision(self(), build)
|
||||
&& !build.dead() && (type.collidesTeam || build.team != team) && !(type.pierceBuilding && hasCollided(build.id))){
|
||||
|
||||
|
||||
@@ -1,29 +1,41 @@
|
||||
package mindustry.entities.comp;
|
||||
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@Component
|
||||
abstract class ChildComp implements Posc{
|
||||
@Import float x, y;
|
||||
abstract class ChildComp implements Posc, Rotc{
|
||||
@Import float x, y, rotation;
|
||||
|
||||
@Nullable Posc parent;
|
||||
float offsetX, offsetY;
|
||||
boolean rotWithParent;
|
||||
float offsetX, offsetY, offsetPos, offsetRot;
|
||||
|
||||
@Override
|
||||
public void add(){
|
||||
if(parent != null){
|
||||
offsetX = x - parent.getX();
|
||||
offsetY = y - parent.getY();
|
||||
if(rotWithParent && parent instanceof Rotc r){
|
||||
offsetPos = -r.rotation();
|
||||
offsetRot = rotation - r.rotation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(parent != null){
|
||||
x = parent.getX() + offsetX;
|
||||
y = parent.getY() + offsetY;
|
||||
if(rotWithParent && parent instanceof Rotc r){
|
||||
x = parent.getX() + Angles.trnsx(r.rotation() + offsetPos, offsetX, offsetY);
|
||||
y = parent.getY() + Angles.trnsy(r.rotation() + offsetPos, offsetX, offsetY);
|
||||
rotation = r.rotation() + offsetRot;
|
||||
}else{
|
||||
x = parent.getX() + offsetX;
|
||||
y = parent.getY() + offsetY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
|
||||
float explosiveness = 2f + item().explosiveness * stack().amount * 1.53f;
|
||||
float flammability = item().flammability * stack().amount / 1.9f;
|
||||
float power = item().charge * stack().amount * 150f;
|
||||
float power = item().charge * Mathf.pow(stack().amount, 1.11f) * 160f;
|
||||
|
||||
if(!spawnedByCore){
|
||||
Damage.dynamicExplosion(x, y, flammability, explosiveness, power, bounds() / 2f, state.rules.damageExplosions, item().flammability > 1, team, type.deathExplosionEffect);
|
||||
|
||||
Reference in New Issue
Block a user