forked from Anuken/Mindustry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Anuken#3 from Quezler/nydus
updateing code
- Loading branch information
Showing
11 changed files
with
61 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package mindustry.server.nydus; | ||
|
||
import arc.*; | ||
import mindustry.game.EventType.*; | ||
import mindustry.gen.*; | ||
import mindustry.world.blocks.power.*; | ||
import mindustry.world.meta.*; | ||
|
||
import static mindustry.Vars.*; | ||
|
||
public class PowerFlower implements ApplicationListener{ | ||
|
||
@Override | ||
public void init(){ | ||
Events.on(BlockBuildEndEvent.class, event -> { | ||
Core.app.post(() -> { | ||
final int[] solar = {0}; | ||
state.teams.getActive().each(teamData -> { | ||
indexer.getAllied(teamData.team, BlockFlag.solar).each(tile -> { | ||
if(tile.block instanceof SolarGenerator){ | ||
solar[0] += (tile.block.size * tile.block.size); | ||
} | ||
}); | ||
}); | ||
|
||
float multiplier = 1f + (solar[0] * 0.01f); | ||
|
||
if(multiplier == state.rules.solarPowerMultiplier) return; | ||
state.rules.solarPowerMultiplier = multiplier; | ||
Call.onSetRules(state.rules); | ||
}); | ||
}); | ||
} | ||
} |