This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Computer Cart (Component)
feldim2425 edited this page Mar 24, 2016
·
15 revisions
This component is automatically added if you place a computer cart and it provides all functions to controll the break and the engine. The component is called "computercart" in the component list.
####Lua functions: #####Minecart control methods:
-
setBrake(enable:boolean):boolean, stringenables / disables the brake and returns the new mode and a string if it failed. -
getBrake():booleanreturns true if the brake is enabled. -
getEngineSpeed():numberreturns the current speed of the engine. -
getCartSpeed():numberreturns the current speed of the cart. -
setEngineSpeed(speed:number):numberset the speed of the engine 0.0 is off, returns the new speed. -
getMaxSpeed():numberget the max. speed of the cart (not of the rail!). -
setLightColor(color:number)set the color of the light.(0xRRGGBB) example.: 0xFFFFFF(while) 0xFF0000(red) -
getLightColor():numberget the color of the light. -
rotate()rotate the cart by 180 degrees -
onRail():boolenCheck if the cart is on a rail. -
hasNetworkRail():booleanCheck if the cart is connected to a network rail. -
isLocked():booleanCheck if the cart is locked on a track
#####Inventory methods:
-
inventorySize():numberThe size of this device's internal inventory. -
select([slot:number]):numberGet the currently selected slot; set the selected slot if specified. -
count([slot:number]):numberGet the number of items in the specified slot, otherwise in the selected slot. -
space([slot:number]):numberGet the remaining space in the specified slot, otherwise in the selected slot. -
compareTo(otherSlot:number):booleanCompare the contents of the selected slot to the contents of the specified slot. -
transferTo(toSlot:number[,amount:number]):booleanMove up to the specified amount of items from the selected slot into the specified slot. -
drop(side:number[, count:number=64]):booleanDrops items from the selected slot towards the specified side. -
suck(side:number[, count:number=64]):booleanSuck up items from the specified side.
#####Tank methods:
-
tankCount():numberThe number of tanks installed in the device. -
selectTank([index:number]):numberSelect a tank and/or get the number of the currently selected tank. -
tankLevel([index:number]):numberGet the fluid amount in the specified or selected tank. -
tankSpace([index:number]):numberGet the remaining fluid capacity in the specified or selected tank. -
compareFluidTo(index:number):booleanCompares the fluids in the selected and the specified tank. Returns true if equal. -
transferFluidTo(index:number[, count:number=1000]):booleanMove the specified amount of fluid from the selected tank into the specified tank. -
compareFluid(side:number):booleanCompare the fluid in the selected tank with the fluid on the specified side. Returns true if equal. -
drain(side:number[, amount:number=1000]):boolean, number or stringDrains the specified amount of fluid from the specified side. Returns the amount drained, or an error message. -
fill(side:number[, amount:number=1000]):boolean, number or stringEject the specified amount of fluid to the specified side. Returns the amount ejected or an error message.
NOTE: The computer cart can not place or take fluid blocks. This function would be useless because fluids destroy rails.
####Signals/Events:
-
inventory_changed():numbercalled when a item in the main inventory changed. args.: number:slotnumber. -
engine_failed():numbercalled when the engine shut down wihout calling setEngineSpeed(). For Example if there is not enougth energy left. args: number:enginspeed. -
track_state():booleancalled when the cart moved on a track or leaved a track. args.: boolean:onrail. -
network_rail():booleancalled when a netowrk rail connects or disconnects. args.: boolean:connected. -
cart_lockdown():booleancalled when the cart gets locked/released on/from a Railcraft track. args.: boolean:locked