Skip to content

Commit

Permalink
Close #29
Browse files Browse the repository at this point in the history
  • Loading branch information
LotuxPunk committed Mar 18, 2020
1 parent ad6ed4d commit 42c92ac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import net.tardis.mod.common.systems.SystemStabilizers;
import net.tardis.mod.common.tileentity.TileEntityDoor;
import net.tardis.mod.common.tileentity.TileEntityTardis;
import net.tardis.mod.util.SpaceTimeCoord;
Expand All @@ -19,7 +20,7 @@
public class TileTardisInterfaceBase extends TileEntity {
private UUID ownerID = null;
public static final String peripheralName = "tardisinterface";
public static final List<String> METHODS = Arrays.asList("getTardisPos", "setTardisDestination","startFlight", "setDoors", "isInFlight","setFueling", "getArtron","isDoorsOpened","canFly","getTravelTime", "getWaypoint","setWaypoint","getHealthComponent","getDimensionsID","getDimensionName","setRelativePos", "setDimensionPos", "getTardisDestination", "getDimension", "getTargetDimension", "setField", "getField", "getSystemName", "setStealth", "getStealth");
public static final List<String> METHODS = Arrays.asList("getTardisPos", "setTardisDestination","startFlight", "setDoors", "isInFlight","setFueling", "getArtron","isDoorsOpened","canFly","getTravelTime", "getWaypoint","setWaypoint","getHealthComponent","getDimensionsID","getDimensionName","setRelativePos", "setDimensionPos", "getTardisDestination", "getDimension", "getTargetDimension", "setField", "getField", "getSystemName", "setStealth", "getStealth", "setStabilizers", "getStabilizers");

@Override
public void readFromNBT(NBTTagCompound compound) {
Expand Down Expand Up @@ -243,4 +244,15 @@ public Object[] setStealth(Object[] arguments, TileEntityTardis te){
public Object[] getStealth(TileEntityTardis te){
return new Object[] {te.isStealthMode()};
}

public Object[] setStabilizers(Object[] arguments, TileEntityTardis te){
if (!canRun())
return new Object[]{"Aprioritron broken"};
te.getSystem(SystemStabilizers.class).setOn((boolean)arguments[0]);
return new Object[] {null};
}

public Object[] getStabilizers(TileEntityTardis te){
return new Object[] {te.getSystem(SystemStabilizers.class).isOn()};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ public Object[] callMethod(@Nonnull IComputerAccess computer, @Nonnull ILuaConte
throw new LuaException("Too many arguments : getStealth()");
return getStealth(te);
}
case 25:{//setStabilizers
if (arguments.length < 1)
throw new LuaException("Not enough argument : setStabilizers(boolean)");
if (arguments.length > 1)
throw new LuaException("Too many arguments : setStabilizers(boolean)");
return setStabilizers(arguments, te);
}
case 26:{//getStabilizers
if (arguments.length >= 1)
throw new LuaException("Too many arguments : getStabilizers()");
return getStabilizers(te);
}
default:{
throw new LuaException("No method found");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,14 @@ public Object[] setStealth(Context context, Arguments args){
public Object[] getStealth(Context context, Arguments args){
return getStealth(getTardis());
}

@Callback
public Object[] setStabilizers (Context context, Arguments args){
return setStabilizers(args.toArray(), getTardis());
}

@Callback
public Object[] getStabilizers(Context context, Arguments args){
return getStabilizers(getTardis());
}
}

0 comments on commit 42c92ac

Please sign in to comment.