Speedometer, Smoke trail, and engine sound on newgen chassis
Reply chain from #5
local speaker = peripheral.find("speaker")
local top_speed = 0
repeat
pos = ship.getWorldspacePosition()
vel = ship.getVelocity()
speed = math.sqrt(vel.x ^ 2 + vel.y ^ 2 + vel.z ^ 2)
readable_speed = math.floor((speed * 3.6) + 0.5)
top_speed = math.max(readable_speed, top_speed)
speed_text = 'data merge block ~ ~ ~4 {Text2:\'[{"text":"' .. readable_speed ..
' ","color":"green"},{"text":"|","color":"white"},{"text":" ' .. top_speed ..
'","color":"yellow"}]\','
graphic = 'Text4:\'[{"text":"' .. ("\\\\u2588"):rep(math.min(math.floor(readable_speed / 10), 9)) ..
'","color":"green"},{"text":"' .. ("\\\\u2592"):rep(9 - math.floor(readable_speed / 10)) ..
' ","color":"yellow"}]\'}'
speedometer = speed_text .. graphic
particles = "particle minecraft:campfire_cosy_smoke " .. pos.x .. " " .. pos.y - 1 .. " " .. pos.z ..
" 0.6 0.3 0.6 0 " .. 4
if speed > 0.4 then
commands.exec(particles)
else
top_speed = 0
end
commands.exec(speedometer)
sleep(0.001)
until i == 1
If you change the code to display to a screen or some other output (and remove the particle part) then you can make a survival friendly version with a regular or advanced computer
:clueless:
8 replies not shown · View on Discord