mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-25 05:51:47 -08:00
Networked unit control / Mimic AI prototype
This commit is contained in:
parent
7dca6b2a30
commit
3bb2b646db
32 changed files with 87 additions and 36 deletions
|
|
@ -168,6 +168,16 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||
Core.app.post(() -> Events.fire(new TapConfigEvent(tile, player, value)));
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
public static void onUnitControl(Playerc player, @Nullable Unitc unit){
|
||||
if(unit == null){
|
||||
player.clearUnit();
|
||||
//make sure it's AI controlled, so players can't overwrite each other
|
||||
}else if(unit.isAI() && unit.team() == player.team()){
|
||||
player.unit(unit);
|
||||
}
|
||||
}
|
||||
|
||||
public Eachable<BuildRequest> allRequests(){
|
||||
return cons -> {
|
||||
for(BuildRequest request : player.builder().requests()) cons.get(request);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue