Skip to content

Commit

Permalink
update changelog, minor tweaks to anchor driver
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Jun 4, 2023
1 parent c7ebcca commit 418792b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* [#3533] Added support for observing the contents of fluid container items.
* [#3620] Fixed OC 1.8.0+ regression involving API arguments and numbers.
* [#3013] Fixed rare server-side deadlock when sending disk activity update packets.
* Added Railcraft anchor driver.
* Added Spanish translation.
* Fixed bugs in internal wcwidth() implementation and updated it to cover Unicode 12.
* Fixed server->client synchronization for some types of GPU bitblt operations.
Expand Down
19 changes: 13 additions & 6 deletions src/main/scala/li/cil/oc/integration/railcraft/DriverAnchor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import mods.railcraft.common.blocks.machine.alpha.{EnumMachineAlpha, TileAnchorW
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection

import java.util.Objects

object DriverAnchor extends DriverSidedTileEntity {
def getTileEntityClass: Class[_] = classOf[TileAnchorWorld]

Expand All @@ -21,24 +23,29 @@ object DriverAnchor extends DriverSidedTileEntity {
override def preferredName = "anchor"
override def priority = 5

@Callback(doc = "function():int -- Get remaining anchor time in ticks.")
@Callback(doc = "function():int -- Get the remaining anchor time, in ticks.")
def getFuel(context: Context, args: Arguments): Array[AnyRef] = result(tile.getAnchorFuel)

@Callback(doc = "function():string -- Get the anchor owner name.")
def getOwner(context: Context, args: Arguments): Array[AnyRef] = result(tile.getOwner.getName)
@Callback(doc = "function():string -- Get the anchor owner name.")
def getOwner(context: Context, args: Arguments): Array[AnyRef] =
if (tile.getOwner == null || tile.getOwner.getName == null || Objects.equals(tile.getOwner.getName, "[Railcraft]"))
result()
else
result(tile.getOwner.getName)

@Callback(doc = "function():string -- Get the anchor type.")
def getType(context: Context, args: Arguments): Array[AnyRef] = tile.getMachineType match {
case EnumMachineAlpha.WORLD_ANCHOR => result("world")
case EnumMachineAlpha.ADMIN_ANCHOR => result("admin")
case EnumMachineAlpha.PERSONAL_ANCHOR => result("personal")
case _ => result("passive")
case EnumMachineAlpha.PASSIVE_ANCHOR => result("passive")
case _ => result("missing")
}

@Callback(doc = "function():table -- Get the anchor input slot contents.")
@Callback(doc = "function():table -- Get the anchor fuel slot's contents.")
def getFuelSlotContents(context: Context, args: Arguments): Array[AnyRef] = result(tile.getStackInSlot(0))

@Callback(doc = "function():boolean -- If the anchor is disabled with redstone.")
@Callback(doc = "function():boolean -- If the anchor is disabled (powered by redstone).")
def isDisabled(context: Context, args: Arguments): Array[AnyRef] = result(tile.isPowered)
}
}

0 comments on commit 418792b

Please sign in to comment.