forked from Anuken/Mindustry
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1204264
commit b8eac2b
Showing
2 changed files
with
94 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
![Logo](core/assets-raw/sprites/ui/logo.png) | ||
|
||
### About MindustryX | ||
Two Purpose: | ||
* Add more useful apis to `core`, which can be use by mods/plugins. | ||
* More features/optimizations for `server`. | ||
|
||
All change should be compatible with official client.(can be optional with client support) | ||
This project will publish more frequently than the upstream. | ||
|
||
### Build | ||
This project will only release server builds. | ||
Core api will be available in Jitpack. | ||
|
||
If you'd rather compile on your own, `gradlew server:dist`. | ||
|
||
### Version rule | ||
`v144.102` match the upstream version `v144.1`, `02` is the MDTX patch version(begin with 1, reset each large version) | ||
|
||
### Commit Tag | ||
* S: server only change. | ||
* SO: server and optional client. | ||
* SC: server and client all need to update, otherwise will disable. | ||
* C: client only change. | ||
* API: no effect, pure api for mod/plugin. | ||
* fix: fix bug of previous feature | ||
* None tag means not game change. | ||
|
||
### Features | ||
See `./patches/`. | ||
|
||
## Contribution | ||
1. execute `scripts/applyPatches` then work in `work/` | ||
2. commit your feature in `work/`, then `scripts/genPatches.sh` and commit in root. | ||
![Logo](core/assets-raw/sprites/ui/logo.png) | ||
|
||
### About MindustryX | ||
Two Purpose: | ||
* Add more useful apis to `core`, which can be use by mods/plugins. | ||
* More features/optimizations for `server`. | ||
|
||
All change should be compatible with official client.(can be optional with client support) | ||
This project will publish more frequently than the upstream. | ||
|
||
### Build | ||
This project will only release server builds. | ||
Core api will be available in Jitpack. | ||
|
||
If you'd rather compile on your own, `gradlew server:dist`. | ||
|
||
### Version rule | ||
`v144.102` match the upstream version `v144.1`, `02` is the MDTX patch version(begin with 1, reset each large version) | ||
|
||
### Commit Tag | ||
* S: server only change. | ||
* SO: server and optional client. | ||
* SC: server and client all need to update, otherwise will disable. | ||
* C: client only change. | ||
* API: no effect, pure api for mod/plugin. | ||
* fix: fix bug of previous feature | ||
* None tag means not game change. | ||
|
||
### Features | ||
See `./patches/`. | ||
|
||
## Contribution | ||
1. download the submodule [Mindustry](https://github.com/Anuken/Mindustry) using git | ||
2. execute `scripts/applyPatches` then work in `work/` | ||
3. commit your feature in `work/` | ||
4. move the git tag `base` to the place you worked on, then execute `scripts/genPatches.sh` and commit in root. |
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,58 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: nanmenyangde <[email protected]> | ||
Date: Sun, 3 Dec 2023 15:55:56 +0800 | ||
Subject: [PATCH] API: add PlayerTeamChangeEvent | ||
|
||
--- | ||
.../src/mindustry/entities/comp/PlayerComp.java | 4 ++++ | ||
.../events/PlayerTeamChangeEvent.java | 17 +++++++++++++++++ | ||
2 files changed, 21 insertions(+) | ||
create mode 100644 core/src/mindustryX/events/PlayerTeamChangeEvent.java | ||
|
||
diff --git a/core/src/mindustry/entities/comp/PlayerComp.java b/core/src/mindustry/entities/comp/PlayerComp.java | ||
index c995d3d9f0cfb8b0bda22026fa1d6dc9bc6a6cfa..f1d6c196790e8754f74f4be76d50a4f5426be057 100644 | ||
--- a/core/src/mindustry/entities/comp/PlayerComp.java | ||
+++ b/core/src/mindustry/entities/comp/PlayerComp.java | ||
@@ -23,6 +23,7 @@ import mindustry.net.Packets.*; | ||
import mindustry.ui.*; | ||
import mindustry.world.blocks.storage.*; | ||
import mindustry.world.blocks.storage.CoreBlock.*; | ||
+import mindustryX.events.*; | ||
|
||
import static mindustry.Vars.*; | ||
|
||
@@ -186,8 +187,11 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra | ||
} | ||
|
||
public void team(Team team){ | ||
+ Team last = this.team; | ||
this.team = team; | ||
unit.team(team); | ||
+ //MDTX: PlayerTeamChangeEvent | ||
+ Events.fire(new PlayerTeamChangeEvent(last, self())); | ||
} | ||
|
||
public void clearUnit(){ | ||
diff --git a/core/src/mindustryX/events/PlayerTeamChangeEvent.java b/core/src/mindustryX/events/PlayerTeamChangeEvent.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..0b78f18c5bf288b2cc1b652b79431ba8abf9c268 | ||
--- /dev/null | ||
+++ b/core/src/mindustryX/events/PlayerTeamChangeEvent.java | ||
@@ -0,0 +1,17 @@ | ||
+package mindustryX.events; | ||
+ | ||
+import mindustry.game.*; | ||
+import mindustry.gen.*; | ||
+import mindustryX.*; | ||
+ | ||
+/** Called after the team of a player changed. */ | ||
+@MindustryXApi | ||
+public class PlayerTeamChangeEvent{ | ||
+ public final Team previous; | ||
+ public final Player player; | ||
+ public PlayerTeamChangeEvent(Team previous, Player player) { | ||
+ this.previous = previous; | ||
+ this.player = player; | ||
+ } | ||
+} | ||
+ |