Advertisement
Calame

station.lua

Feb 8th, 2021 (edited)
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. -- A station object.
  2. Station = {
  3.     -- type = mine, farm, smeltery, warehouse, etc.
  4.     type = "",
  5.     -- sub_type = "minecraft:oak_wood", "minecraft:sugar_cane", etc.
  6.     sub_type = "",
  7.     -- position of the output chest ( if any ).
  8.     output_pos = vector.new( 0, 0, 0 ),
  9.     -- position of the input chest ( if any ).
  10.     input_pos = vector.new( 0, 0, 0 ),
  11.     -- position of the fuel chest ( if any ).
  12.     fuel_pos = vector.new( 0, 0, 0 ),
  13.     -- the number of turtle currently working there.
  14.     workers = 0,
  15.     -- max number of turtle that can work there.
  16.     max_worker = 1,
  17.     -- if the station has been built and is ready to operate.
  18.     is_set_up = false,
  19.     -- A list of erssources needed to build the station.
  20.     res_to_build = {},
  21. }
  22.  
  23. function Station:new( o )
  24.     o = o or {}
  25.     setmetatable( o, self )
  26.     self.__index = self
  27.     return o
  28. end
  29.  
  30. function Station:build()
  31. end
  32.  
  33. function Station:start_work()
  34.     if workers >= max_worker then
  35.         print( "can't work there. It's full.")
  36.         return false
  37.     end
  38.  
  39.     workers = workers + 1
  40.     return true
  41. end
  42.  
  43. return Station
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement