From e5ded1f2ddf5efb9db03891cad74a333db28efba Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 25 Jul 2023 18:47:46 -0700 Subject: [PATCH 1/3] Allow fluid type configuration for ConsumeCoolant (#8841) * Allow fluid type configuration for ConsumeCoolant * Methods --- core/src/mindustry/world/Block.java | 4 ++++ .../mindustry/world/consumers/ConsumeCoolant.java | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index badcbc1d5f..b694f51db8 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -997,6 +997,10 @@ public class Block extends UnlockableContent implements Senseable{ return consume(new ConsumeCoolant(amount)); } + public ConsumeCoolant consumeCoolant(float amount, boolean allowLiquid, boolean allowGas){ + return consume(new ConsumeCoolant(amount, allowLiquid, allowGas)); + } + public T consume(T consume){ if(consume instanceof ConsumePower){ //there can only be one power consumer diff --git a/core/src/mindustry/world/consumers/ConsumeCoolant.java b/core/src/mindustry/world/consumers/ConsumeCoolant.java index 0afdd55a09..9ff7a9b57d 100644 --- a/core/src/mindustry/world/consumers/ConsumeCoolant.java +++ b/core/src/mindustry/world/consumers/ConsumeCoolant.java @@ -3,11 +3,19 @@ package mindustry.world.consumers; /** A ConsumeLiquidFilter that consumes specific coolant, selected based on stats. */ public class ConsumeCoolant extends ConsumeLiquidFilter{ public float maxTemp = 0.5f, maxFlammability = 0.1f; + public boolean allowLiquid = true, allowGas = false; - public ConsumeCoolant(float amount){ - this.filter = liquid -> liquid.coolant && !liquid.gas && liquid.temperature <= maxTemp && liquid.flammability < maxFlammability; + public ConsumeCoolant(float amount, boolean allowLiquid, boolean allowGas){ + this.allowLiquid = allowLiquid; + this.allowGas = allowGas; + + this.filter = liquid -> liquid.coolant && (this.allowLiquid && !liquid.gas || this.allowGas && liquid.gas) && liquid.temperature <= maxTemp && liquid.flammability < maxFlammability; this.amount = amount; } + + public ConsumeCoolant(float amount){ + this(amount, true, false); + } public ConsumeCoolant(){ this(1f); From a92bce2c1469f35acbb9802a17158f11b3573565 Mon Sep 17 00:00:00 2001 From: BalaM314 <71201189+BalaM314@users.noreply.github.com> Date: Wed, 26 Jul 2023 11:14:20 +0530 Subject: [PATCH 2/3] Expose NetServer currentlyKicking for plugin access (#8817) * Expose NetServer currentlyKicking for plugin access * Move code around * Un-final * currentlyKicking no longer needs a wrapper array --- core/src/mindustry/core/NetServer.java | 126 ++++++++++++------------- 1 file changed, 62 insertions(+), 64 deletions(-) diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index 2fb5de2f71..f3e80093f4 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -98,6 +98,15 @@ public class NetServer implements ApplicationListener{ private boolean closing = false, pvpAutoPaused = true; private Interval timer = new Interval(10); private IntSet buildHealthChanged = new IntSet(); + + /** Current kick session. */ + public @Nullable VoteSession currentlyKicking = null; + /** Duration of a kick in seconds. */ + public static int kickDuration = 60 * 60; + /** Voting round duration in seconds. */ + public static float voteDuration = 0.5f * 60; + /** Cooldown between votes in seconds. */ + public static int voteCooldown = 60 * 5; private ReusableByteOutStream writeBuffer = new ReusableByteOutStream(127); private Writes outputBuffer = new Writes(new DataOutputStream(writeBuffer)); @@ -340,62 +349,8 @@ public class NetServer implements ApplicationListener{ Groups.player.each(Player::admin, a -> a.sendMessage(raw, player, args[0])); }); - //duration of a kick in seconds - int kickDuration = 60 * 60; - //voting round duration in seconds - float voteDuration = 0.5f * 60; - //cooldown between votes in seconds - int voteCooldown = 60 * 5; - - class VoteSession{ - Player target; - ObjectIntMap voted = new ObjectIntMap<>(); - VoteSession[] map; - Timer.Task task; - int votes; - - public VoteSession(VoteSession[] map, Player target){ - this.target = target; - this.map = map; - this.task = Timer.schedule(() -> { - if(!checkPass()){ - Call.sendMessage(Strings.format("[lightgray]Vote failed. Not enough votes to kick[orange] @[lightgray].", target.name)); - map[0] = null; - task.cancel(); - } - }, voteDuration); - } - - void vote(Player player, int d){ - int lastVote = voted.get(player.uuid(), 0) | voted.get(admins.getInfo(player.uuid()).lastIP, 0); - votes -= lastVote; - - votes += d; - voted.put(player.uuid(), d); - voted.put(admins.getInfo(player.uuid()).lastIP, d); - - Call.sendMessage(Strings.format("[lightgray]@[lightgray] has voted on kicking[orange] @[lightgray].[accent] (@/@)\n[lightgray]Type[orange] /vote [] to agree.", - player.name, target.name, votes, votesRequired())); - - checkPass(); - } - - boolean checkPass(){ - if(votes >= votesRequired()){ - Call.sendMessage(Strings.format("[orange]Vote passed.[scarlet] @[orange] will be banned from the server for @ minutes.", target.name, (kickDuration / 60))); - Groups.player.each(p -> p.uuid().equals(target.uuid()), p -> p.kick(KickReason.vote, kickDuration * 1000)); - map[0] = null; - task.cancel(); - return true; - } - return false; - } - } - //cooldowns per player ObjectMap cooldowns = new ObjectMap<>(); - //current kick sessions - VoteSession[] currentlyKicking = {null}; clientCommands.register("votekick", "[player] [reason...]", "Vote to kick a player with a valid reason.", (args, player) -> { if(!Config.enableVotekick.bool()){ @@ -413,7 +368,7 @@ public class NetServer implements ApplicationListener{ return; } - if(currentlyKicking[0] != null){ + if(currentlyKicking != null){ player.sendMessage("[scarlet]A vote is already in progress."); return; } @@ -454,11 +409,11 @@ public class NetServer implements ApplicationListener{ return; } - VoteSession session = new VoteSession(currentlyKicking, found); + VoteSession session = new VoteSession(found); session.vote(player, 1); Call.sendMessage(Strings.format("[lightgray]Reason:[orange] @[lightgray].", args[1])); vtime.reset(); - currentlyKicking[0] = session; + currentlyKicking = session; } }else{ player.sendMessage("[scarlet]No player [orange]'" + args[0] + "'[scarlet] found."); @@ -467,13 +422,13 @@ public class NetServer implements ApplicationListener{ }); clientCommands.register("vote", "", "Vote to kick the current player. Admin can cancel the voting with 'c'.", (arg, player) -> { - if(currentlyKicking[0] == null){ + if(currentlyKicking == null){ player.sendMessage("[scarlet]Nobody is being voted on."); }else{ if(player.admin && arg[0].equalsIgnoreCase("c")){ Call.sendMessage(Strings.format("[lightgray]Vote canceled by admin[orange] @[lightgray].", player.name)); - currentlyKicking[0].task.cancel(); - currentlyKicking[0] = null; + currentlyKicking.task.cancel(); + currentlyKicking = null; return; } @@ -489,17 +444,17 @@ public class NetServer implements ApplicationListener{ }; //hosts can vote all they want - if((currentlyKicking[0].voted.get(player.uuid(), 2) == sign || currentlyKicking[0].voted.get(admins.getInfo(player.uuid()).lastIP, 2) == sign)){ + if((currentlyKicking.voted.get(player.uuid(), 2) == sign || currentlyKicking.voted.get(admins.getInfo(player.uuid()).lastIP, 2) == sign)){ player.sendMessage(Strings.format("[scarlet]You've already voted @. Sit down.", arg[0].toLowerCase())); return; } - if(currentlyKicking[0].target == player){ + if(currentlyKicking.target == player){ player.sendMessage("[scarlet]You can't vote on your own trial."); return; } - if(currentlyKicking[0].target.team() != player.team()){ + if(currentlyKicking.target.team() != player.team()){ player.sendMessage("[scarlet]You can't vote for other teams."); return; } @@ -509,7 +464,7 @@ public class NetServer implements ApplicationListener{ return; } - currentlyKicking[0].vote(player, sign); + currentlyKicking.vote(player, sign); } }); @@ -1125,6 +1080,49 @@ public class NetServer implements ApplicationListener{ } } + public class VoteSession{ + Player target; + ObjectIntMap voted = new ObjectIntMap<>(); + Timer.Task task; + int votes; + + public VoteSession(Player target){ + this.target = target; + this.task = Timer.schedule(() -> { + if(!checkPass()){ + Call.sendMessage(Strings.format("[lightgray]Vote failed. Not enough votes to kick[orange] @[lightgray].", target.name)); + currentlyKicking = null; + task.cancel(); + } + }, voteDuration); + } + + void vote(Player player, int d){ + int lastVote = voted.get(player.uuid(), 0) | voted.get(admins.getInfo(player.uuid()).lastIP, 0); + votes -= lastVote; + + votes += d; + voted.put(player.uuid(), d); + voted.put(admins.getInfo(player.uuid()).lastIP, d); + + Call.sendMessage(Strings.format("[lightgray]@[lightgray] has voted on kicking[orange] @[lightgray].[accent] (@/@)\n[lightgray]Type[orange] /vote [] to agree.", + player.name, target.name, votes, votesRequired())); + + checkPass(); + } + + boolean checkPass(){ + if(votes >= votesRequired()){ + Call.sendMessage(Strings.format("[orange]Vote passed.[scarlet] @[orange] will be banned from the server for @ minutes.", target.name, (kickDuration / 60))); + Groups.player.each(p -> p.uuid().equals(target.uuid()), p -> p.kick(KickReason.vote, kickDuration * 1000)); + currentlyKicking = null; + task.cancel(); + return true; + } + return false; + } + } + public interface TeamAssigner{ Team assign(Player player, Iterable players); } From 24c01f97d3757d4a26fd69b902da91bcd62ef2ec Mon Sep 17 00:00:00 2001 From: Tomoko <65737359+Taras4k@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:59:30 +0300 Subject: [PATCH 3/3] Rename my server and change ips (#8845) --- servers_v7.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servers_v7.json b/servers_v7.json index 8f58007594..ef4f4399c1 100644 --- a/servers_v7.json +++ b/servers_v7.json @@ -28,8 +28,8 @@ "address": ["0nera.ru:7777"] }, { - "name": "Voiddustry Network", - "address": ["45.144.66.250:6566", "45.144.66.250:6567" ,"45.144.66.250:6565", "45.144.66.250:6561"] + "name": "Untitled Mindustry Servers", + "address": ["45.144.66.250:6567", "45.144.66.250:6501"] }, { "name": "C.A.M.S.",