mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-10 15:19:24 +07:00
Cleanup
This commit is contained in:
parent
4813d6c8ff
commit
148abaccd9
Binary file not shown.
Before Width: | Height: | Size: 266 KiB |
Binary file not shown.
Before Width: | Height: | Size: 77 KiB |
@ -1,8 +1,14 @@
|
||||
package mindustry.content;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.ctype.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
import static mindustry.Vars.world;
|
||||
|
||||
public class Weathers implements ContentList{
|
||||
public static Weather
|
||||
rain,
|
||||
@ -11,9 +17,35 @@ public class Weathers implements ContentList{
|
||||
@Override
|
||||
public void load(){
|
||||
snow = new Weather("snow"){
|
||||
Rand rand = new Rand();
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
rand.setSeed(0);
|
||||
float yspeed = 2f, xspeed = 0.25f;
|
||||
float padding = 16f;
|
||||
float size = 12f;
|
||||
Core.camera.bounds(Tmp.r1);
|
||||
Tmp.r1.grow(padding);
|
||||
|
||||
for(int i = 0; i < 100; i++){
|
||||
float scl = rand.random(0.5f, 1f);
|
||||
float scl2 = rand.random(0.5f, 1f);
|
||||
float sscl = rand.random(0.2f, 1f);
|
||||
float x = (rand.random(0f, world.unitWidth()) + Time.time() * xspeed * scl2);
|
||||
float y = (rand.random(0f, world.unitHeight()) - Time.time() * yspeed * scl);
|
||||
|
||||
x += Mathf.sin(y, rand.random(30f, 80f), rand.random(1f, 7f));
|
||||
|
||||
x -= Tmp.r1.x;
|
||||
y -= Tmp.r1.y;
|
||||
x = Mathf.mod(x, Tmp.r1.width);
|
||||
y = Mathf.mod(y, Tmp.r1.height);
|
||||
x += Tmp.r1.x;
|
||||
y += Tmp.r1.y;
|
||||
|
||||
Draw.rect("circle-shadow", x, y, size * sscl, size * sscl);
|
||||
}
|
||||
//TODO
|
||||
}
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ public class Logic implements ApplicationListener{
|
||||
public Logic(){
|
||||
Events.on(WorldLoadEvent.class, event -> {
|
||||
//TODO remove later
|
||||
Weathers.snow.create();
|
||||
//Weathers.snow.create();
|
||||
});
|
||||
|
||||
Events.on(WaveEvent.class, event -> {
|
||||
|
@ -79,8 +79,8 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
||||
Vec2 v = Geometry.overlap(Tmp.r1, Tmp.r2, true);
|
||||
float tm = mass() + unit.mass();
|
||||
float s1 = mass() / tm, s2 = unit.mass() / tm;
|
||||
impulse(v.x*s2/scale, v.y*s2/scale);
|
||||
unit.impulse(-v.x*s1/scale, -v.y*s1/scale);
|
||||
move(v.x*s2/scale, v.y*s2/scale);
|
||||
unit.move(-v.x*s1/scale, -v.y*s1/scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -139,6 +139,11 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
||||
tile.entity.unitOn(this);
|
||||
}
|
||||
|
||||
//kill when stuck in wall
|
||||
if(isGrounded() && tile.solid()){
|
||||
kill();
|
||||
}
|
||||
|
||||
//apply damage
|
||||
if(floor.damageTaken > 0f){
|
||||
damageContinuous(floor.damageTaken);
|
||||
|
@ -28,7 +28,7 @@ public class AIController implements UnitController{
|
||||
}
|
||||
|
||||
protected boolean retarget(){
|
||||
return timer.get(timerTarget, 20);
|
||||
return timer.get(timerTarget, 30);
|
||||
}
|
||||
|
||||
protected void targetClosest(){
|
||||
|
Loading…
Reference in New Issue
Block a user