Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -882,7 +882,7 @@ public class EntityProcess extends BaseProcessor{
|
|||||||
|
|
||||||
for(Smethod method : methods){
|
for(Smethod method : methods){
|
||||||
String signature = method.toString();
|
String signature = method.toString();
|
||||||
if(signatures.contains(signature)) continue;
|
if(!signatures.add(signature)) continue;
|
||||||
|
|
||||||
Stype compType = interfaceToComp(method.type());
|
Stype compType = interfaceToComp(method.type());
|
||||||
MethodSpec.Builder builder = MethodSpec.overriding(method.e).addModifiers(Modifier.PUBLIC, Modifier.FINAL);
|
MethodSpec.Builder builder = MethodSpec.overriding(method.e).addModifiers(Modifier.PUBLIC, Modifier.FINAL);
|
||||||
@@ -893,25 +893,29 @@ public class EntityProcess extends BaseProcessor{
|
|||||||
builder.addAnnotation(OverrideCallSuper.class); //just in case
|
builder.addAnnotation(OverrideCallSuper.class); //just in case
|
||||||
|
|
||||||
if(!method.isVoid()){
|
if(!method.isVoid()){
|
||||||
if(method.name().equals("isNull")){
|
String methodName = method.name();
|
||||||
builder.addStatement("return true");
|
switch(methodName){
|
||||||
}else if(method.name().equals("id")){
|
case "isNull":
|
||||||
|
builder.addStatement("return true");
|
||||||
|
break;
|
||||||
|
case "id":
|
||||||
builder.addStatement("return -1");
|
builder.addStatement("return -1");
|
||||||
}else{
|
break;
|
||||||
Svar variable = compType == null || method.params().size > 0 ? null : compType.fields().find(v -> v.name().equals(method.name()));
|
case "toString":
|
||||||
String desc = variable == null ? null : variable.descString();
|
builder.addStatement("return $S", className);
|
||||||
if(variable == null || !varInitializers.containsKey(desc)){
|
break;
|
||||||
builder.addStatement("return " + getDefault(method.ret().toString()));
|
default:
|
||||||
}else{
|
Svar variable = compType == null || method.params().size > 0 ? null : compType.fields().find(v -> v.name().equals(methodName));
|
||||||
String init = varInitializers.get(desc);
|
String desc = variable == null ? null : variable.descString();
|
||||||
builder.addStatement("return " + (init.equals("{}") ? "new " + variable.mirror().toString() : "") + init);
|
if(variable == null || !varInitializers.containsKey(desc)){
|
||||||
}
|
builder.addStatement("return " + getDefault(method.ret().toString()));
|
||||||
|
}else{
|
||||||
|
String init = varInitializers.get(desc);
|
||||||
|
builder.addStatement("return " + (init.equals("{}") ? "new " + variable.mirror().toString() : "") + init);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nullBuilder.addMethod(builder.build());
|
nullBuilder.addMethod(builder.build());
|
||||||
|
|
||||||
signatures.add(signature);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nullsBuilder.addField(FieldSpec.builder(type, Strings.camelize(baseName)).initializer("new " + className + "()").addModifiers(Modifier.FINAL, Modifier.STATIC, Modifier.PUBLIC).build());
|
nullsBuilder.addField(FieldSpec.builder(type, Strings.camelize(baseName)).initializer("new " + className + "()").addModifiers(Modifier.FINAL, Modifier.STATIC, Modifier.PUBLIC).build());
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public class BuilderAI extends AIController{
|
|||||||
float minDst = Float.MAX_VALUE;
|
float minDst = Float.MAX_VALUE;
|
||||||
Player closest = null;
|
Player closest = null;
|
||||||
for(var player : Groups.player){
|
for(var player : Groups.player){
|
||||||
if(player.unit().canBuild() && !player.dead()){
|
if(player.unit().canBuild() && !player.dead() && player.team() == unit.team){
|
||||||
float dst = player.dst2(unit);
|
float dst = player.dst2(unit);
|
||||||
if(dst < minDst){
|
if(dst < minDst){
|
||||||
closest = player;
|
closest = player;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class Lightning{
|
|||||||
bhit = false;
|
bhit = false;
|
||||||
|
|
||||||
for(int i = 0; i < length / 2; i++){
|
for(int i = 0; i < length / 2; i++){
|
||||||
hitCreate.create(null, team, x, y, rotation, damage, 1f, 1f, hitter);
|
hitCreate.create(null, team, x, y, rotation, damage * (hitter == null ? 1f : hitter.damageMultiplier()), 1f, 1f, hitter);
|
||||||
lines.add(new Vec2(x + Mathf.range(3f), y + Mathf.range(3f)));
|
lines.add(new Vec2(x + Mathf.range(3f), y + Mathf.range(3f)));
|
||||||
|
|
||||||
if(lines.size > 1){
|
if(lines.size > 1){
|
||||||
|
|||||||
@@ -141,9 +141,9 @@ public class EnergyFieldAbility extends Ability{
|
|||||||
}else{
|
}else{
|
||||||
anyNearby = true;
|
anyNearby = true;
|
||||||
if(other instanceof Building b){
|
if(other instanceof Building b){
|
||||||
b.damage(unit.team, damage);
|
b.damage(unit.team, damage * state.rules.unitDamage(unit.team));
|
||||||
}else{
|
}else{
|
||||||
other.damage(damage);
|
other.damage(damage * state.rules.unitDamage(unit.team));
|
||||||
}
|
}
|
||||||
if(other instanceof Statusc s){
|
if(other instanceof Statusc s){
|
||||||
s.apply(status, statusDuration);
|
s.apply(status, statusDuration);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ abstract class CrawlComp implements Posc, Rotc, Hitboxc, Unitc{
|
|||||||
|
|
||||||
//TODO area damage to units
|
//TODO area damage to units
|
||||||
if(t.build != null && t.build.team != team){
|
if(t.build != null && t.build.team != team){
|
||||||
t.build.damage(team, type.crushDamage * Time.delta);
|
t.build.damage(team, type.crushDamage * Time.delta * state.rules.unitDamage(team));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Mathf.chanceDelta(0.025)){
|
if(Mathf.chanceDelta(0.025)){
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(type.legSplashDamage > 0){
|
if(type.legSplashDamage > 0){
|
||||||
Damage.damage(team, l.base.x, l.base.y, type.legSplashRange, type.legSplashDamage, false, true);
|
Damage.damage(team, l.base.x, l.base.y, type.legSplashRange, type.legSplashDamage * state.rules.unitDamage(team), false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ abstract class TankComp implements Posc, Flyingc, Hitboxc, Unitc, ElevationMovec
|
|||||||
//damage radius is 1 tile smaller to prevent it from just touching walls as it passes
|
//damage radius is 1 tile smaller to prevent it from just touching walls as it passes
|
||||||
&& Math.max(Math.abs(dx), Math.abs(dy)) <= r - 1){
|
&& Math.max(Math.abs(dx), Math.abs(dy)) <= r - 1){
|
||||||
|
|
||||||
t.build.damage(team, type.crushDamage * Time.delta * t.block().crushDamageMultiplier);
|
t.build.damage(team, type.crushDamage * Time.delta * t.block().crushDamageMultiplier * state.rules.unitDamage(team));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -618,7 +618,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
|
|
||||||
//if this unit crash landed (was flying), damage stuff in a radius
|
//if this unit crash landed (was flying), damage stuff in a radius
|
||||||
if(type.flying && !spawnedByCore && type.createWreck){
|
if(type.flying && !spawnedByCore && type.createWreck){
|
||||||
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true);
|
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f * state.rules.unitDamage(team), true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!headless && type.createScorch){
|
if(!headless && type.createScorch){
|
||||||
|
|||||||
@@ -45,8 +45,10 @@ public class Scripts implements Disposable{
|
|||||||
try{
|
try{
|
||||||
Object o = context.evaluateString(scope, text, "console.js", 1);
|
Object o = context.evaluateString(scope, text, "console.js", 1);
|
||||||
if(o instanceof NativeJavaObject n) o = n.unwrap();
|
if(o instanceof NativeJavaObject n) o = n.unwrap();
|
||||||
if(o instanceof Undefined) o = "undefined";
|
if(o == null) o = "null";
|
||||||
return String.valueOf(o);
|
else if(o instanceof Undefined) o = "undefined";
|
||||||
|
var out = o.toString();
|
||||||
|
return out == null ? "null" : out;
|
||||||
}catch(Throwable t){
|
}catch(Throwable t){
|
||||||
return getError(t, false);
|
return getError(t, false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user