Emanate impl / Rotation lock
This commit is contained in:
BIN
core/assets-raw/sprites/units/emanate-cell.png
Normal file
BIN
core/assets-raw/sprites/units/emanate-cell.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
core/assets-raw/sprites/units/emanate.png
Normal file
BIN
core/assets-raw/sprites/units/emanate.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -446,3 +446,4 @@
|
|||||||
63260=reinforced-liquid-junction|block-reinforced-liquid-junction-ui
|
63260=reinforced-liquid-junction|block-reinforced-liquid-junction-ui
|
||||||
63259=oxidation-chamber|block-oxidation-chamber-ui
|
63259=oxidation-chamber|block-oxidation-chamber-ui
|
||||||
63258=surge-crucible|block-surge-crucible-ui
|
63258=surge-crucible|block-surge-crucible-ui
|
||||||
|
63257=emanate|unit-emanate-ui
|
||||||
|
|||||||
Binary file not shown.
@@ -1988,7 +1988,7 @@ public class Blocks implements ContentList{
|
|||||||
//TODO cost
|
//TODO cost
|
||||||
requirements(Category.effect, with(Items.beryllium, 11000, Items.graphite, 11000, Items.tungsten, 9000, Items.carbide, 10000));
|
requirements(Category.effect, with(Items.beryllium, 11000, Items.graphite, 11000, Items.tungsten, 9000, Items.carbide, 10000));
|
||||||
|
|
||||||
unitType = UnitTypes.evoke;
|
unitType = UnitTypes.emanate;
|
||||||
health = 22000;
|
health = 22000;
|
||||||
itemCapacity = 16000;
|
itemCapacity = 16000;
|
||||||
size = 6;
|
size = 6;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package mindustry.content;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.math.geom.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import mindustry.ai.types.*;
|
import mindustry.ai.types.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
@@ -2417,6 +2418,7 @@ public class UnitTypes implements ContentList{
|
|||||||
isCounted = false;
|
isCounted = false;
|
||||||
envDisabled = 0;
|
envDisabled = 0;
|
||||||
|
|
||||||
|
outlineColor = Pal.darkOutline;
|
||||||
lowAltitude = false;
|
lowAltitude = false;
|
||||||
flying = true;
|
flying = true;
|
||||||
targetAir = false;
|
targetAir = false;
|
||||||
@@ -2475,6 +2477,7 @@ public class UnitTypes implements ContentList{
|
|||||||
isCounted = false;
|
isCounted = false;
|
||||||
envDisabled = 0;
|
envDisabled = 0;
|
||||||
|
|
||||||
|
outlineColor = Pal.darkOutline;
|
||||||
lowAltitude = false;
|
lowAltitude = false;
|
||||||
flying = true;
|
flying = true;
|
||||||
targetAir = false;
|
targetAir = false;
|
||||||
@@ -2483,7 +2486,7 @@ public class UnitTypes implements ContentList{
|
|||||||
buildSpeed = 1.4f;
|
buildSpeed = 1.4f;
|
||||||
drag = 0.06f;
|
drag = 0.06f;
|
||||||
speed = 2.6f;
|
speed = 2.6f;
|
||||||
rotateSpeed = 6f;
|
rotateSpeed = 5f;
|
||||||
accel = 0.11f;
|
accel = 0.11f;
|
||||||
itemCapacity = 70;
|
itemCapacity = 70;
|
||||||
health = 600f;
|
health = 600f;
|
||||||
@@ -2526,6 +2529,77 @@ public class UnitTypes implements ContentList{
|
|||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
emanate = new UnitType("emanate"){{
|
||||||
|
defaultController = BuilderAI::new;
|
||||||
|
isCounted = false;
|
||||||
|
envDisabled = 0;
|
||||||
|
|
||||||
|
outlineColor = Pal.darkOutline;
|
||||||
|
lowAltitude = false;
|
||||||
|
flying = true;
|
||||||
|
targetAir = false;
|
||||||
|
mineSpeed = 8f;
|
||||||
|
mineTier = 3;
|
||||||
|
buildSpeed = 1.4f;
|
||||||
|
drag = 0.06f;
|
||||||
|
speed = 2.6f;
|
||||||
|
rotateSpeed = 3f;
|
||||||
|
accel = 0.11f;
|
||||||
|
itemCapacity = 140;
|
||||||
|
health = 1500f;
|
||||||
|
armor = 3f;
|
||||||
|
hitSize = 36f;
|
||||||
|
commandLimit = 9;
|
||||||
|
buildBeamOffset = 72f / 4f;
|
||||||
|
engineSize = 0;
|
||||||
|
payloadCapacity = Mathf.sqr(3f) * tilePayload;
|
||||||
|
|
||||||
|
float es = 3.8f;
|
||||||
|
|
||||||
|
setEnginesMirror(
|
||||||
|
new UnitEngine(49 / 4f, 51 / 4f, es, 45f),
|
||||||
|
new UnitEngine(67 / 4f, -30 / 4f, es, 315f),
|
||||||
|
new UnitEngine(49 / 4f, -62 / 4f, es, 315f)
|
||||||
|
);
|
||||||
|
|
||||||
|
Vec2[] positions = {new Vec2(30f, 50f), new Vec2(60f, -15f)};
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for(var pos : positions){
|
||||||
|
int fi = i;
|
||||||
|
weapons.add(new Weapon("incite-weapon"){{
|
||||||
|
rotate = true;
|
||||||
|
reload = fi == 0 ? 25f : 35f;
|
||||||
|
rotateSpeed = 4f;
|
||||||
|
x = pos.x/4f;
|
||||||
|
y = pos.y/4f;
|
||||||
|
shootY = 5.75f;
|
||||||
|
recoil = 2f;
|
||||||
|
rotationLimit = 90f;
|
||||||
|
layerOffset = -0.01f;
|
||||||
|
|
||||||
|
bullet = new BasicBulletType(5f, 17){{
|
||||||
|
width = 7f;
|
||||||
|
height = 12f;
|
||||||
|
shootEffect = Fx.sparkShoot;
|
||||||
|
smokeEffect = Fx.shootBigSmoke;
|
||||||
|
pierceCap = 2;
|
||||||
|
pierce = true;
|
||||||
|
pierceBuilding = true;
|
||||||
|
hitColor = backColor = trailColor = Pal.bulletYellowBack;
|
||||||
|
frontColor = Color.white;
|
||||||
|
trailWidth = 1.5f;
|
||||||
|
trailLength = 7;
|
||||||
|
hitEffect = despawnEffect = Fx.hitBulletColor;
|
||||||
|
}};
|
||||||
|
}});
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}};
|
||||||
|
|
||||||
|
|
||||||
//TODO emanate (+ better names)
|
//TODO emanate (+ better names)
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ public class Weapon implements Cloneable{
|
|||||||
public float shotDelay = 0;
|
public float shotDelay = 0;
|
||||||
/** The half-radius of the cone in which shooting will start. */
|
/** The half-radius of the cone in which shooting will start. */
|
||||||
public float shootCone = 5f;
|
public float shootCone = 5f;
|
||||||
|
/** Cone in which the weapon can rotate relative to its mount. */
|
||||||
|
public float rotationLimit = 361f;
|
||||||
/** ticks to cool down the heat region */
|
/** ticks to cool down the heat region */
|
||||||
public float cooldownTime = 20f;
|
public float cooldownTime = 20f;
|
||||||
/** random sound pitch range */
|
/** random sound pitch range */
|
||||||
@@ -147,6 +149,10 @@ public class Weapon implements Cloneable{
|
|||||||
|
|
||||||
//TODO copy-pasted code
|
//TODO copy-pasted code
|
||||||
public void drawOutline(Unit unit, WeaponMount mount){
|
public void drawOutline(Unit unit, WeaponMount mount){
|
||||||
|
//apply layer offset, roll it back at the end
|
||||||
|
float z = Draw.z();
|
||||||
|
Draw.z(z + layerOffset);
|
||||||
|
|
||||||
float
|
float
|
||||||
rotation = unit.rotation - 90,
|
rotation = unit.rotation - 90,
|
||||||
weaponRotation = rotation + (rotate ? mount.rotation : 0),
|
weaponRotation = rotation + (rotate ? mount.rotation : 0),
|
||||||
@@ -160,6 +166,8 @@ public class Weapon implements Cloneable{
|
|||||||
outlineRegion.height * Draw.scl,
|
outlineRegion.height * Draw.scl,
|
||||||
weaponRotation);
|
weaponRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Draw.z(z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Unit unit, WeaponMount mount){
|
public void draw(Unit unit, WeaponMount mount){
|
||||||
@@ -215,6 +223,12 @@ public class Weapon implements Cloneable{
|
|||||||
|
|
||||||
mount.targetRotation = Angles.angle(axisX, axisY, mount.aimX, mount.aimY) - unit.rotation;
|
mount.targetRotation = Angles.angle(axisX, axisY, mount.aimX, mount.aimY) - unit.rotation;
|
||||||
mount.rotation = Angles.moveToward(mount.rotation, mount.targetRotation, rotateSpeed * Time.delta);
|
mount.rotation = Angles.moveToward(mount.rotation, mount.targetRotation, rotateSpeed * Time.delta);
|
||||||
|
if(rotationLimit < 360){
|
||||||
|
float dst = Angles.angleDist(mount.rotation, 0f);
|
||||||
|
if(dst > rotationLimit/2f){
|
||||||
|
mount.rotation = Angles.moveToward(mount.rotation, 0, dst - rotationLimit/2f);
|
||||||
|
}
|
||||||
|
}
|
||||||
}else if(!rotate){
|
}else if(!rotate){
|
||||||
mount.rotation = 0;
|
mount.rotation = 0;
|
||||||
mount.targetRotation = unit.angleTo(mount.aimX, mount.aimY);
|
mount.targetRotation = unit.angleTo(mount.aimX, mount.aimY);
|
||||||
|
|||||||
Reference in New Issue
Block a user