Bullet parts / Improved clipping in #7282
This commit is contained in:
@@ -1169,7 +1169,7 @@ rules.cleanupdeadteams = Clean Up Defeated Team Buildings (PvP)
|
|||||||
rules.corecapture = Capture Core On Destruction
|
rules.corecapture = Capture Core On Destruction
|
||||||
rules.polygoncoreprotection = Polygonal Core Protection
|
rules.polygoncoreprotection = Polygonal Core Protection
|
||||||
rules.placerangecheck = Placement Range Check
|
rules.placerangecheck = Placement Range Check
|
||||||
rules.enemyCheat = Infinite AI (Red Team) Resources
|
rules.enemyCheat = Infinite Enemy Team Resources
|
||||||
rules.blockhealthmultiplier = Block Health Multiplier
|
rules.blockhealthmultiplier = Block Health Multiplier
|
||||||
rules.blockdamagemultiplier = Block Damage Multiplier
|
rules.blockdamagemultiplier = Block Damage Multiplier
|
||||||
rules.unitbuildspeedmultiplier = Unit Production Speed Multiplier
|
rules.unitbuildspeedmultiplier = Unit Production Speed Multiplier
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import mindustry.annotations.Annotations.*;
|
|||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
|
import mindustry.entities.part.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -190,6 +191,8 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
public int despawnUnitCount = 1;
|
public int despawnUnitCount = 1;
|
||||||
/** Random offset distance from the original bullet despawn/hit coordinate. */
|
/** Random offset distance from the original bullet despawn/hit coordinate. */
|
||||||
public float despawnUnitRadius = 0.1f;
|
public float despawnUnitRadius = 0.1f;
|
||||||
|
/** Extra visual parts for this bullet. */
|
||||||
|
public Seq<DrawPart> parts = new Seq<>();
|
||||||
|
|
||||||
/** Color of trail behind bullet. */
|
/** Color of trail behind bullet. */
|
||||||
public Color trailColor = Pal.missileYellowBack;
|
public Color trailColor = Pal.missileYellowBack;
|
||||||
@@ -481,6 +484,7 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
|
|
||||||
public void draw(Bullet b){
|
public void draw(Bullet b){
|
||||||
drawTrail(b);
|
drawTrail(b);
|
||||||
|
drawParts(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTrail(Bullet b){
|
public void drawTrail(Bullet b){
|
||||||
@@ -493,6 +497,17 @@ public class BulletType extends Content implements Cloneable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawParts(Bullet b){
|
||||||
|
if(parts.size > 0){
|
||||||
|
DrawPart.params.set(b.fin(), 0f, 0f, 0f, 0f, 0f, b.x, b.y, b.rotation());
|
||||||
|
DrawPart.params.life = b.fin();
|
||||||
|
|
||||||
|
for(int i = 0; i < parts.size; i++){
|
||||||
|
parts.get(i).draw(DrawPart.params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void drawLight(Bullet b){
|
public void drawLight(Bullet b){
|
||||||
if(lightOpacity <= 0f || lightRadius <= 0f) return;
|
if(lightOpacity <= 0f || lightRadius <= 0f) return;
|
||||||
Drawf.light(b, lightRadius, lightColor, lightOpacity);
|
Drawf.light(b, lightRadius, lightColor, lightOpacity);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import arc.util.*;
|
|||||||
public class Trail{
|
public class Trail{
|
||||||
public int length;
|
public int length;
|
||||||
|
|
||||||
protected final FloatSeq points;
|
protected FloatSeq points;
|
||||||
protected float lastX = -1, lastY = -1, lastAngle = -1, counter = 0f, lastW = 0f;
|
protected float lastX = -1, lastY = -1, lastAngle = -1, counter = 0f, lastW = 0f;
|
||||||
|
|
||||||
public Trail(int length){
|
public Trail(int length){
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package mindustry.maps.filters;
|
package mindustry.maps.filters;
|
||||||
|
|
||||||
import arc.func.*;
|
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
@@ -95,35 +94,6 @@ public class MirrorFilter extends GenerateFilter{
|
|||||||
|
|
||||||
void clipHalfLine(Vec2 v, float xmin, float ymin, float xmax, float ymax){
|
void clipHalfLine(Vec2 v, float xmin, float ymin, float xmax, float ymax){
|
||||||
//finds the coordinates of the intersection of the half line created by the vector at (0,0) with the clipping rectangle
|
//finds the coordinates of the intersection of the half line created by the vector at (0,0) with the clipping rectangle
|
||||||
|
v.scl(1f / Math.max(Math.abs(v.x < 0 ? v.x / xmin : v.x / xmax), Math.abs(v.y < 0 ? v.y / ymin : v.y / ymax)));
|
||||||
if(v.x < 0){
|
|
||||||
if(v.y < 0){
|
|
||||||
if(v.x * ymin > v.y * xmin){
|
|
||||||
v.set(xmin, xmin * v.y/v.x);
|
|
||||||
}else{
|
|
||||||
v.set(ymin * v.x/v.y, ymin);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(v.x * ymax < v.y * xmin){
|
|
||||||
v.set(xmin, xmin * v.y/v.x);
|
|
||||||
}else{
|
|
||||||
v.set(ymax * v.x/v.y, ymax);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(v.y < 0){
|
|
||||||
if(v.x * ymin < v.y * xmax){
|
|
||||||
v.set(xmax, xmax * v.y/v.x);
|
|
||||||
}else{
|
|
||||||
v.set(ymin * v.x/v.y, ymin);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(v.x * ymax > v.y * xmax){
|
|
||||||
v.set(xmax, xmax * v.y/v.x);
|
|
||||||
}else{
|
|
||||||
v.set(ymax * v.x/v.y, ymax);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user