Jump to content

tonyenkiducx

Alpha Tester
  • Posts

    2
  • Joined

  • Last visited

Profile Information

  • backer_title
    Silver Founder
  • Alpha
    Yes

tonyenkiducx's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. A little script I knocked up to show the capacity of attached crates. There are 2 parameters to set, the name of the resource you are monitoring in the crates, and a unit mass(KG/L). You will need a screen attached called "Screen", or change the relevant part in the script. Containers don't need a specific name. This is my first time coding LUA, or in DU, so any improvements I can make, please let me know. objectMassPerLitre = 2.7 --export containerContentsName = "Aluminium" --export local containerArray = {} local containerCount = 0 for key, value in pairs(unit) do if type(value) == "table" and type(value.export) == "table" then if value.getSelfMass then containerCount = containerCount + 1 containerArray[containerCount] = value end end end local containerMassContentsCount = 0 local totalVolume = 0 for i= 1, containerCount do containerMassContentsCount = containerMassContentsCount + containerArray[i].getItemsMass() if containerArray[i].getSelfMass() == 1281.31 then totalVolume = totalVolume + 8000 elseif containerArray[i].getSelfMass() == 229.09 then totalVolume = totalVolume + 1000 elseif containerArray[i].getSelfMass() == 7421.35 then totalVolume = totalVolume + 64000 elseif containerArray[i].getSelfMass() == 14842.7 then totalVolume = totalVolume + 128000 end end local totalContentsVolume = math.floor(containerMassContentsCount / objectMassPerLitre) local message = containerCount .." containers of ".. containerContentsName .. " <br> " .. totalContentsVolume .."<emp>L</emp> used of ".. totalVolume .. "<emp>L</emp> total space" if oreDisplay == nil then oreDisplay = Screen.addContent(2,50,message) else Screen.resetContent(oreDisplay, message) end
  2. Long time fan and kickstarter, looking forward to building some cool stuff!
  3. discordauth:aTBsXapohaRVgSRnpa1WcHD7EMTuuvnufWmxVt2McU0=

×
×
  • Create New...