mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
Unfinished/WIP turret
This commit is contained in:
parent
9807974de3
commit
52b5ed57bf
Binary file not shown.
After Width: | Height: | Size: 658 B |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
BIN
core/assets-raw/sprites/blocks/turrets/afflict/afflict.png
Normal file
BIN
core/assets-raw/sprites/blocks/turrets/afflict/afflict.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -564,3 +564,4 @@
|
||||
63120=mech-refabricator|block-mech-refabricator-ui
|
||||
63119=ship-refabricator|block-ship-refabricator-ui
|
||||
63118=slag-heater|block-slag-heater-ui
|
||||
63117=afflict|block-afflict-ui
|
||||
|
Binary file not shown.
@ -4061,7 +4061,120 @@ public class Blocks{
|
||||
limitRange(-5f);
|
||||
}};
|
||||
|
||||
//TODO 3+ more turrets.
|
||||
//TODO very WIP
|
||||
afflict = new PowerTurret("afflict"){{
|
||||
requirements(Category.turret, with(Items.surgeAlloy, 100, Items.silicon, 200, Items.graphite, 250, Items.oxide, 40));
|
||||
|
||||
shootType = new BasicBulletType(){{
|
||||
shootEffect = new MultiEffect(Fx.shootTitan, new WaveEffect(){{
|
||||
colorTo = Pal.surge;
|
||||
sizeTo = 26f;
|
||||
lifetime = 14f;
|
||||
strokeFrom = 4f;
|
||||
}});
|
||||
smokeEffect = Fx.shootSmokeTitan;
|
||||
hitColor = Pal.surge;
|
||||
|
||||
sprite = "large-orb";
|
||||
trailEffect = Fx.missileTrail;
|
||||
trailInterval = 3f;
|
||||
trailParam = 4f;
|
||||
speed = 5f;
|
||||
damage = 150f;
|
||||
lifetime = 80f;
|
||||
width = height = 16f;
|
||||
backColor = Pal.surge;
|
||||
frontColor = Color.white;
|
||||
shrinkX = shrinkY = 0f;
|
||||
trailColor = Pal.surge;
|
||||
trailLength = 12;
|
||||
trailWidth = 2.2f;
|
||||
despawnEffect = hitEffect = new ExplosionEffect(){{
|
||||
waveColor = Pal.surge;
|
||||
smokeColor = Color.gray;
|
||||
sparkColor = Pal.sap;
|
||||
waveStroke = 4f;
|
||||
waveRad = 40f;
|
||||
}};
|
||||
|
||||
intervalBullet = new LightningBulletType(){{
|
||||
damage = 18;
|
||||
collidesAir = false;
|
||||
ammoMultiplier = 1f;
|
||||
lightningColor = Pal.surge;
|
||||
lightningLength = 5;
|
||||
lightningLengthRand = 8;
|
||||
|
||||
//for visual stats only.
|
||||
buildingDamageMultiplier = 0.25f;
|
||||
|
||||
lightningType = new BulletType(0.0001f, 0f){{
|
||||
lifetime = Fx.lightning.lifetime;
|
||||
hitEffect = Fx.hitLancer;
|
||||
despawnEffect = Fx.none;
|
||||
status = StatusEffects.shocked;
|
||||
statusDuration = 10f;
|
||||
hittable = false;
|
||||
lightColor = Color.white;
|
||||
buildingDamageMultiplier = 0.25f;
|
||||
}};
|
||||
}};
|
||||
|
||||
bulletInterval = 3f;
|
||||
|
||||
lightningColor = Pal.surge;
|
||||
lightningDamage = 25;
|
||||
lightning = 8;
|
||||
lightningLength = 5;
|
||||
lightningLengthRand = 8;
|
||||
}};
|
||||
|
||||
drawer = new DrawTurret("reinforced-"){{
|
||||
parts.add(new RegionPart("-blade"){{
|
||||
progress = PartProgress.recoil;
|
||||
heatColor = Color.valueOf("ff6214");
|
||||
mirror = true;
|
||||
under = true;
|
||||
moveX = 2f;
|
||||
moveY = -1f;
|
||||
moveRot = -5f;
|
||||
}},
|
||||
new RegionPart("-blade-glow"){{
|
||||
progress = PartProgress.recoil;
|
||||
heatProgress = PartProgress.warmup;
|
||||
heatColor = Color.valueOf("ff6214");
|
||||
drawRegion = false;
|
||||
mirror = true;
|
||||
under = true;
|
||||
moveX = 2f;
|
||||
moveY = -1f;
|
||||
moveRot = -5f;
|
||||
}});
|
||||
}};
|
||||
|
||||
consumePower(2f);
|
||||
heatRequirement = 8f;
|
||||
maxHeatEfficiency = 2f;
|
||||
|
||||
inaccuracy = 1f;
|
||||
shake = 2f;
|
||||
shootY = 4;
|
||||
outlineColor = Pal.darkOutline;
|
||||
size = 4;
|
||||
envEnabled |= Env.space;
|
||||
reload = 80f;
|
||||
cooldownTime = reload;
|
||||
recoil = 3f;
|
||||
range = 290;
|
||||
shootCone = 15f;
|
||||
scaledHealth = 180;
|
||||
rotateSpeed = 1.5f;
|
||||
researchCostMultiplier = 0.05f;
|
||||
|
||||
limitRange(9f);
|
||||
}};
|
||||
|
||||
//TODO 5 more turrets.
|
||||
|
||||
//endregion
|
||||
//region units
|
||||
|
@ -38,11 +38,8 @@ public class ItemTurret extends Turret{
|
||||
|
||||
/** Makes copies of all bullets and limits their range. */
|
||||
public void limitRange(float margin){
|
||||
for(var entry : ammoTypes.copy().entries()){
|
||||
var bullet = entry.value;
|
||||
float realRange = bullet.rangeChange + range;
|
||||
//doesn't handle drag
|
||||
bullet.lifetime = (realRange + margin) / bullet.speed;
|
||||
for(var entry : ammoTypes.entries()){
|
||||
limitRange(entry.value, margin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,10 @@ public class PowerTurret extends Turret{
|
||||
stats.add(Stat.ammo, StatValues.ammo(ObjectMap.of(this, shootType)));
|
||||
}
|
||||
|
||||
public void limitRange(float margin){
|
||||
limitRange(shootType, margin);
|
||||
}
|
||||
|
||||
public class PowerTurretBuild extends TurretBuild{
|
||||
|
||||
@Override
|
||||
|
@ -186,6 +186,12 @@ public class Turret extends ReloadTurret{
|
||||
drawer.getRegionsToOutline(this, out);
|
||||
}
|
||||
|
||||
public void limitRange(BulletType bullet, float margin){
|
||||
float realRange = bullet.rangeChange + range;
|
||||
//doesn't handle drag
|
||||
bullet.lifetime = (realRange + margin) / bullet.speed;
|
||||
}
|
||||
|
||||
public static abstract class AmmoEntry{
|
||||
public int amount;
|
||||
|
||||
|
@ -1,11 +1,15 @@
|
||||
package mindustry.world.blocks.environment;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.util.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.graphics.MultiPacker.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
/**
|
||||
* Do not use in mods. This class provides no new functionality, and is only used for the Mindustry sprite generator.
|
||||
* Use the standard Floor class instead.
|
||||
* Blends water together with a standard floor. No new mechanics.
|
||||
* */
|
||||
public class ShallowLiquid extends Floor{
|
||||
public @Nullable Floor liquidBase, floorBase;
|
||||
@ -26,4 +30,29 @@ public class ShallowLiquid extends Floor{
|
||||
cacheLayer = liquidBase.cacheLayer;
|
||||
shallow = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createIcons(MultiPacker packer){
|
||||
//TODO might not be necessary at all, but I am not sure yet
|
||||
//super.createIcons(packer);
|
||||
|
||||
if(liquidBase != null && floorBase != null){
|
||||
var overlay = Core.atlas.getPixmap(liquidBase.region);
|
||||
int index = 0;
|
||||
for(TextureRegion region : floorBase.variantRegions()){
|
||||
var res = Core.atlas.getPixmap(region).crop();
|
||||
for(int x = 0; x < res.width; x++){
|
||||
for(int y = 0; y < res.height; y++){
|
||||
res.setRaw(x, y, Pixmap.blend((overlay.getRaw(x, y) & 0xffffff00) | (int)(liquidOpacity * 255), res.getRaw(x, y)));
|
||||
}
|
||||
}
|
||||
|
||||
String baseName = this.name + "" + (++index);
|
||||
packer.add(PageType.environment, baseName, res);
|
||||
packer.add(PageType.editor, "editor-" + baseName, res);
|
||||
|
||||
res.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user