Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
nekit508 committed Mar 25, 2024
1 parent 65edce3 commit 3bb9610
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions core/annotations/src/main/resources/classids.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ general=11
legion=3
legionnaire=13
lord=4
myriad=14
radix=10
sergeant=5
smoke=12
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{fields:[{name:abilities,type:"mindustry.entities.abilities.Ability[]"},{name:ammo,type:float},{name:controller,type:mindustry.entities.units.UnitController},{name:elevation,type:float},{name:flag,type:double},{name:health,type:float},{name:isShooting,type:boolean},{name:mineTile,type:mindustry.world.Tile},{name:mounts,type:"mindustry.entities.units.WeaponMount[]"},{name:plans,type:arc.struct.Queue<mindustry.entities.units.BuildPlan>},{name:rotation,type:float},{name:shield,type:float},{name:spawnedByCore,type:boolean},{name:stack,type:mindustry.type.ItemStack},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>},{name:team,type:mindustry.game.Team},{name:type,type:mindustry.type.UnitType},{name:updateBuilding,type:boolean},{name:vel,type:arc.math.geom.Vec2},{name:x,type:float},{name:y,type:float}]}
2 changes: 1 addition & 1 deletion core/src/fos/type/blocks/units/UpgradeCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class UpgradeCenter extends Block {
* @param player player that upgraded weapon
* @param tile UpgradeBuildCenter tile
* */
@Annotations.Remote(called = Annotations.Loc.client, targets = Annotations.Loc.both, forward = true)
@Annotations.Remote(called = Annotations.Loc.both, targets = Annotations.Loc.both, forward = true)
public static void upgrade(Player player, Tile tile) {
// check received packet integrity (other validation server-side)
if (tile == null || tile.build == null || !(tile.build instanceof UpgradeCenterBuild ucb)) return;
Expand Down
16 changes: 12 additions & 4 deletions core/src/fos/type/units/comp/LumoniPlayerUnitComp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fos.type.units.comp;

import arc.util.Log;
import arc.util.io.*;
import fos.FOSTypeIO;
import fos.type.content.WeaponSet;
Expand All @@ -15,11 +16,10 @@ public abstract class LumoniPlayerUnitComp implements Weaponsc, Entityc, Syncc,
transient boolean isEditedWeapons = false;
transient WeaponSet weaponSet = null;
@Annotations.Import WeaponMount[] mounts;
//transient boolean isTypeSet = false;

@Annotations.Replace
@Override
public void setType(UnitType unitType) { // created for deleting abilities and mounts replacement
public void setType(UnitType unitType) {
type(unitType);
maxHealth(type().health);
drag(type().drag);
Expand All @@ -41,18 +41,26 @@ public void setType(UnitType unitType) { // created for deleting abilities and m

@Override
public void write(Writes write) {
//write.bool(isTypeSet);
write.bool(isEditedWeapons);
write.i(weaponSet == null ? -1 : weaponSet.id);
FOSTypeIO.writeMounts2(write, this);
}

@Override
public void read(Reads read) {
//isTypeSet = read.bool();
isEditedWeapons = read.bool();
int weaponSetId = read.i();
weaponSet = weaponSetId == -1 ? null : WeaponSet.sets.get(weaponSetId);
mounts = FOSTypeIO.readMounts2(read, this);
}

@Override
public void readSync(Reads read) {
isEditedWeapons = read.bool();
}

@Override
public void writeSync(Writes write) {
write.bool(isEditedWeapons);
}
}

0 comments on commit 3bb9610

Please sign in to comment.