mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-30 04:10:41 -08:00
Updated Bullet to use floats
This commit is contained in:
parent
83d1707b56
commit
ce2b73b737
14 changed files with 50 additions and 92 deletions
|
|
@ -142,18 +142,13 @@ project(":ios") {
|
|||
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
|
||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
|
||||
}
|
||||
|
||||
robovm {
|
||||
iosSignIdentity = "a"
|
||||
iosProvisioningProfile = ""
|
||||
}
|
||||
}
|
||||
|
||||
project(":core") {
|
||||
apply plugin: "java"
|
||||
|
||||
dependencies {
|
||||
boolean comp = System.properties["release"] == null || System.properties["release"] == "false"
|
||||
boolean comp = true//System.properties["release"] == null || System.properties["release"] == "false"
|
||||
|
||||
if(!comp){
|
||||
println("NOTICE: Compiling release build.")
|
||||
|
|
@ -161,7 +156,7 @@ project(":core") {
|
|||
println("Compiling DEBUG build.")
|
||||
}
|
||||
|
||||
if(new File('../uCore').exists() && comp){
|
||||
if(new File(projectDir.parent, '../uCore').exists() && comp){
|
||||
compile project(":uCore")
|
||||
}else{
|
||||
compile "com.github.anuken:ucore:$uCoreVersion"
|
||||
|
|
|
|||
|
|
@ -106,22 +106,22 @@ public class Vars{
|
|||
new Locale("de"), new Locale("pt", "BR"), new Locale("ko"), new Locale("in", "ID"), new Locale("ita"), new Locale("es")};
|
||||
|
||||
public static final Color[] playerColors = {
|
||||
Color.valueOf("82759a"),
|
||||
Color.valueOf("c0c1c5"),
|
||||
Color.valueOf("fff0e7"),
|
||||
Color.valueOf("7d2953"),
|
||||
Color.valueOf("ff074e"),
|
||||
Color.valueOf("ff072a"),
|
||||
Color.valueOf("ff76a6"),
|
||||
Color.valueOf("a95238"),
|
||||
Color.valueOf("ffa108"),
|
||||
Color.valueOf("feeb2c"),
|
||||
Color.valueOf("ffcaa8"),
|
||||
Color.valueOf("008551"),
|
||||
Color.valueOf("00e339"),
|
||||
Color.valueOf("423c7b"),
|
||||
Color.valueOf("4b5ef1"),
|
||||
Color.valueOf("2cabfe"),
|
||||
Color.valueOf("82759a"),
|
||||
Color.valueOf("c0c1c5"),
|
||||
Color.valueOf("fff0e7"),
|
||||
Color.valueOf("7d2953"),
|
||||
Color.valueOf("ff074e"),
|
||||
Color.valueOf("ff072a"),
|
||||
Color.valueOf("ff76a6"),
|
||||
Color.valueOf("a95238"),
|
||||
Color.valueOf("ffa108"),
|
||||
Color.valueOf("feeb2c"),
|
||||
Color.valueOf("ffcaa8"),
|
||||
Color.valueOf("008551"),
|
||||
Color.valueOf("00e339"),
|
||||
Color.valueOf("423c7b"),
|
||||
Color.valueOf("4b5ef1"),
|
||||
Color.valueOf("2cabfe"),
|
||||
};
|
||||
|
||||
//server port
|
||||
|
|
|
|||
|
|
@ -258,19 +258,11 @@ public class NetClient extends Module {
|
|||
ui.restart.show();
|
||||
});
|
||||
|
||||
Net.handleClient(FriendlyFireChangePacket.class, packet -> state.friendlyFire = packet.enabled);
|
||||
|
||||
Net.handleClient(NetErrorPacket.class, packet -> {
|
||||
ui.showError(packet.message);
|
||||
disconnectQuietly();
|
||||
});
|
||||
|
||||
Net.handleClient(PlayerAdminPacket.class, packet -> {
|
||||
Player player = playerGroup.getByID(packet.id);
|
||||
player.isAdmin = packet.admin;
|
||||
ui.listfrag.rebuild();
|
||||
});
|
||||
|
||||
Net.handleClient(TracePacket.class, packet -> {
|
||||
Player player = playerGroup.getByID(packet.info.playerid);
|
||||
ui.traces.show(player, packet.info);
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class Bullet extends BulletEntity<BulletType>{
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getDamage(){
|
||||
public float getDamage(){
|
||||
return damage == -1 ? type.damage : damage;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
|||
public StatusEffect status = StatusEffects.none;
|
||||
public float statusIntensity = 0.5f;
|
||||
|
||||
//TODO use float damage
|
||||
public BulletType(float speed, int damage){
|
||||
public BulletType(float speed, float damage){
|
||||
this.speed = speed;
|
||||
this.damage = damage;
|
||||
lifetime = 40f;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class Lightning extends TimedEntity implements Poolable{
|
|||
|
||||
public Color color = Palette.lancerLaser;
|
||||
|
||||
public static void create(Team team, Effect effect, Color color, int damage, float x, float y, float targetAngle, int length){
|
||||
public static void create(Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){
|
||||
Lightning l = Pools.obtain(Lightning.class);
|
||||
|
||||
l.x = x;
|
||||
|
|
@ -68,10 +68,10 @@ public class Lightning extends TimedEntity implements Poolable{
|
|||
Rectangle hitbox = entity.hitbox.getRect(entity.x, entity.y, range);
|
||||
|
||||
if(hitbox.contains(x2, y2) || hitbox.contains(fx, fy)){
|
||||
int result = damage;
|
||||
float result = damage;
|
||||
|
||||
if(entity.status.current() == StatusEffects.wet)
|
||||
result = (int)(result * wetDamageMultiplier);
|
||||
result = (result * wetDamageMultiplier);
|
||||
|
||||
entity.damage(result);
|
||||
Effects.effect(effect, x2, y2, fangle);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.utils.reflect.ClassReflection;
|
|||
import com.badlogic.gdx.utils.reflect.Method;
|
||||
import com.badlogic.gdx.utils.reflect.ReflectionException;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.net.Net.SendMode;
|
||||
import io.anuke.mindustry.net.Packets.InvokePacket;
|
||||
|
|
@ -17,6 +18,8 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static io.anuke.mindustry.Vars.playerGroup;
|
||||
|
||||
/**Class for invoking static methods of other classes remotely.*/
|
||||
public class Invoke {
|
||||
private static ObjectMap<Class, ObjectMap<String, Method>> methods = new ObjectMap<>();
|
||||
|
|
@ -52,6 +55,10 @@ public class Invoke {
|
|||
on(NetEvents.class, methodName, args);
|
||||
}
|
||||
|
||||
public static void eventRemote(String methodName, Object... args){
|
||||
on(NetEvents.class, methodName, args);
|
||||
}
|
||||
|
||||
//TODO refactor to serializer map!
|
||||
static void writeObjects(ByteBuffer buffer, Object[] objects){
|
||||
for(Object o : objects){
|
||||
|
|
@ -76,6 +83,8 @@ public class Invoke {
|
|||
}else if(type == Entity.class){
|
||||
buffer.put((byte)((Entity)o).getGroup().getID());
|
||||
buffer.putInt(((Entity)o).id);
|
||||
}else if(type == Player.class){
|
||||
buffer.putInt(((Player)o).id);
|
||||
}else if(type == Team.class){
|
||||
buffer.put((byte)((Team)o).ordinal());
|
||||
}else if(type == String.class){
|
||||
|
|
@ -110,6 +119,9 @@ public class Invoke {
|
|||
byte group = buffer.get();
|
||||
int id = buffer.getInt();
|
||||
obj = Entities.getGroup(group).getByID(id);
|
||||
}else if(type == Player.class){
|
||||
int id = buffer.getInt();
|
||||
obj = playerGroup.getByID(id);
|
||||
}else if(type == Team.class){
|
||||
obj = Team.values()[buffer.get()];
|
||||
}else if(type == String.class){
|
||||
|
|
|
|||
|
|
@ -18,13 +18,10 @@ import static io.anuke.mindustry.Vars.*;
|
|||
|
||||
public class NetEvents {
|
||||
|
||||
public static void handleFriendlyFireChange(boolean enabled){
|
||||
FriendlyFireChangePacket packet = Pools.obtain(FriendlyFireChangePacket.class);
|
||||
packet.enabled = enabled;
|
||||
public static void friendlyFireChange(boolean enabled){
|
||||
state.friendlyFire = enabled;
|
||||
|
||||
netCommon.sendMessage(enabled ? "[accent]Friendly fire enabled." : "[accent]Friendly fire disabled.");
|
||||
|
||||
Net.send(packet, SendMode.tcp);
|
||||
if(Net.server()) netCommon.sendMessage(enabled ? "[accent]Friendly fire enabled." : "[accent]Friendly fire disabled.");
|
||||
}
|
||||
|
||||
public static void handleGameOver(){
|
||||
|
|
@ -117,12 +114,12 @@ public class NetEvents {
|
|||
Net.send(packet, SendMode.tcp);
|
||||
}
|
||||
|
||||
public static void handleAdminSet(Player player, boolean admin){
|
||||
PlayerAdminPacket packet = Pools.obtain(PlayerAdminPacket.class);
|
||||
packet.admin = admin;
|
||||
packet.id = player.id;
|
||||
public static void adminSet(Player player, boolean admin){
|
||||
player.isAdmin = admin;
|
||||
Net.send(packet, SendMode.tcp);
|
||||
|
||||
if(Net.client()){
|
||||
ui.listfrag.rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleAdministerRequest(Player target, AdminAction action){
|
||||
|
|
|
|||
|
|
@ -477,24 +477,6 @@ public class Packets {
|
|||
public void read(ByteBuffer buffer) { }
|
||||
}
|
||||
|
||||
public static class FriendlyFireChangePacket implements Packet{
|
||||
public boolean enabled;
|
||||
|
||||
@Override
|
||||
public void write(ByteBuffer buffer) {
|
||||
buffer.put(enabled ? 1 : (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteBuffer buffer) {
|
||||
enabled = buffer.get() == 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static class CustomMapPacket extends Streamable{
|
||||
|
||||
}
|
||||
|
||||
public static class MapAckPacket implements Packet{
|
||||
@Override
|
||||
public void write(ByteBuffer buffer) { }
|
||||
|
|
@ -517,23 +499,6 @@ public class Packets {
|
|||
}
|
||||
}
|
||||
|
||||
public static class PlayerAdminPacket implements Packet{
|
||||
public boolean admin;
|
||||
public int id;
|
||||
|
||||
@Override
|
||||
public void write(ByteBuffer buffer) {
|
||||
buffer.put(admin ? (byte)1 : 0);
|
||||
buffer.putInt(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteBuffer buffer) {
|
||||
admin = buffer.get() == 1;
|
||||
id = buffer.getInt();
|
||||
}
|
||||
}
|
||||
|
||||
public static class AdministerRequestPacket implements Packet{
|
||||
public AdminAction action;
|
||||
public int id;
|
||||
|
|
|
|||
|
|
@ -32,12 +32,9 @@ public class Registrator {
|
|||
EntityRequestPacket.class,
|
||||
ConnectConfirmPacket.class,
|
||||
GameOverPacket.class,
|
||||
FriendlyFireChangePacket.class,
|
||||
CustomMapPacket.class,
|
||||
MapAckPacket.class,
|
||||
EntitySpawnPacket.class,
|
||||
NetErrorPacket.class,
|
||||
PlayerAdminPacket.class,
|
||||
AdministerRequestPacket.class,
|
||||
TracePacket.class,
|
||||
InvokePacket.class,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package io.anuke.mindustry.ui.dialogs;
|
|||
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.net.Administration.PlayerInfo;
|
||||
import io.anuke.mindustry.net.Invoke;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetConnection;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
|
|
@ -49,7 +50,7 @@ public class AdminsDialog extends FloatingDialog {
|
|||
for(Player player : playerGroup.all()){
|
||||
NetConnection c = Net.getConnection(player.clientid);
|
||||
if(c != null){
|
||||
NetEvents.handleAdminSet(player, false);
|
||||
Invoke.event("adminSet", player, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package io.anuke.mindustry.ui.fragments;
|
|||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.net.Invoke;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetConnection;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
|
|
@ -48,7 +49,7 @@ public class PlayerListFragment implements Fragment{
|
|||
|
||||
get().addCheck("$text.server.friendlyfire", b -> {
|
||||
state.friendlyFire = b;
|
||||
NetEvents.handleFriendlyFireChange(b);
|
||||
Invoke.event("friendlyFireChange", b);
|
||||
}).growX().update(i -> i.setChecked(state.friendlyFire)).disabled(b -> Net.client()).padRight(5);
|
||||
|
||||
new button("$text.server.bans", () -> {
|
||||
|
|
@ -155,12 +156,12 @@ public class PlayerListFragment implements Fragment{
|
|||
if(netServer.admins.isAdmin(id, connection.address)){
|
||||
ui.showConfirm("$text.confirm", "$text.confirmunadmin", () -> {
|
||||
netServer.admins.unAdminPlayer(id);
|
||||
NetEvents.handleAdminSet(player, false);
|
||||
Invoke.event("adminSet", player, false);
|
||||
});
|
||||
}else{
|
||||
ui.showConfirm("$text.confirm", "$text.confirmadmin", () -> {
|
||||
netServer.admins.adminPlayer(id, connection.address);
|
||||
NetEvents.handleAdminSet(player, true);
|
||||
Invoke.event("adminSet", player, true);
|
||||
});
|
||||
}
|
||||
}).update(b ->{
|
||||
|
|
|
|||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,5 @@
|
|||
#Wed May 02 11:26:02 EDT 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue