Modding Help How to make an item paint?

Discussion in 'Starbound Modding' started by DraikNova, Jul 31, 2017.

  1. DraikNova

    DraikNova Spaceman Spiff

    I've been wanting to make a custom paint tool for a while so as to let me paint foreground and background separately using a right-click based menu, but the vanilla paint tool appears to be written with only a few values determining how much it paints in one go, with its actual capabilities seemingly hardcoded. Is there any way to make an object other than the default paint tool paint an area?
     
  2. lazarus78

    lazarus78 The Waste of Time

    You could probably do it via special avtiveitem weapon and a custom Lua script and alt ability. But that would be quite complex, if at all possible.
     
  3. Errors4l

    Errors4l Spaceman Spiff

    Here's a simple active item script that paints blocks yellow as long as you're firing. Primary fire paints the foreground, alt fire paints the background. Not sure exactly what you're looking for so I'll leave it at this for now.

    Code:
    local colorIndices = { none = 0, red = 1, blue = 2, green = 3, yellow = 4, orange = 5, pink = 6, black = 7, white = 8 }
    local colorNames = { [0] = "none", [1] = "red", [2] = "blue", [3] = "green", [4] = "yellow", [5] = "orange", [6] = "pink", [7] = "black", [8] = "white" }
    
    function update(dt, fireMode, shiftHeld, moves)
      local layer = fireMode == "primary" and "foreground" or fireMode == "alt" and "background"
    
      if layer then
        world.setMaterialColor(activeItem.ownerAimPosition(), layer, colorIndices["yellow"])
      end
    end
     
  4. DraikNova

    DraikNova Spaceman Spiff

    Thanks, that's exactly what I need!
     

Share This Page