mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-06 16:27:25 +07:00
Mud tweaks / Unit count tweaks
This commit is contained in:
@ -15,7 +15,7 @@ void main(){
|
|||||||
vec2 c = v_texCoords.xy;
|
vec2 c = v_texCoords.xy;
|
||||||
vec2 coords = vec2(c.x * u_resolution.x + u_campos.x, c.y * u_resolution.y + u_campos.y);
|
vec2 coords = vec2(c.x * u_resolution.x + u_campos.x, c.y * u_resolution.y + u_campos.y);
|
||||||
|
|
||||||
float btime = u_time / 700000.0;
|
float btime = u_time / 70000.0;
|
||||||
float noise = sin((texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(abs(sin(btime)) * 1.1) * vec2(-0.8, -1.0)).r) / 2.0);
|
float noise = sin((texture2D(u_noise, (coords) / NSCALE + vec2(btime) * vec2(-0.9, 0.8)).r + texture2D(u_noise, (coords) / NSCALE + vec2(abs(sin(btime)) * 1.1) * vec2(-0.8, -1.0)).r) / 2.0);
|
||||||
vec4 color = texture2D(u_texture, c);
|
vec4 color = texture2D(u_texture, c);
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import mindustry.*;
|
|||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
import mindustry.world.blocks.payloads.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -48,6 +49,19 @@ public class TeamIndexProcess implements AsyncProcess{
|
|||||||
activeCounts[team.id][type.id] += amount;
|
activeCounts[team.id][type.id] += amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void count(Unit unit){
|
||||||
|
updateCount(unit.team, unit.type(), 1);
|
||||||
|
if(!unit.deactivated) updateActiveCount(unit.team, unit.type(), 1);
|
||||||
|
|
||||||
|
if(unit instanceof Payloadc){
|
||||||
|
((Payloadc)unit).payloads().each(p -> {
|
||||||
|
if(p instanceof UnitPayload){
|
||||||
|
count(((UnitPayload)p).unit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset(){
|
public void reset(){
|
||||||
counts = new int[Team.all.length];
|
counts = new int[Team.all.length];
|
||||||
@ -71,8 +85,7 @@ public class TeamIndexProcess implements AsyncProcess{
|
|||||||
for(Unit unit : Groups.unit){
|
for(Unit unit : Groups.unit){
|
||||||
tree(unit.team).insert(unit);
|
tree(unit.team).insert(unit);
|
||||||
|
|
||||||
updateCount(unit.team, unit.type(), 1);
|
count(unit);
|
||||||
if(!unit.deactivated) updateActiveCount(unit.team, unit.type(), 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
|
|
||||||
private UnitController controller;
|
private UnitController controller;
|
||||||
private UnitType type;
|
private UnitType type;
|
||||||
boolean spawnedByCore, deactivated;
|
boolean spawnedByCore, deactivated; //TODO remove deactivation boolean
|
||||||
|
|
||||||
transient Seq<Ability> abilities = new Seq<>(0);
|
transient Seq<Ability> abilities = new Seq<>(0);
|
||||||
|
|
||||||
@ -204,7 +204,6 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(){
|
public void add(){
|
||||||
teamIndex.updateCount(team, type, 1);
|
|
||||||
|
|
||||||
//check if over unit cap
|
//check if over unit cap
|
||||||
if(count() > cap() && !spawnedByCore){
|
if(count() > cap() && !spawnedByCore){
|
||||||
@ -213,8 +212,6 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
if(!dead){
|
if(!dead){
|
||||||
Call.unitCapDeath(self());
|
Call.unitCapDeath(self());
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
teamIndex.updateActiveCount(team, type, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user