Anybody who's ever used pPlot:SetResourceType(-1) to remove a resource from a plot will know that while it works and the resource is removed, the resource icon for the plot remains.

To fix this
  1. Add an "Assets" folder to your mod, with a "UI" sub-folder, with an "InGame" sub-sub-folder (exclude the doube quotes but make sure you get the case correct!)
  2. Into the "Assets/UI/InGame" sub-folder, add the "ResourceIconManager.lua" file from the core game directory
  3. Set "Import into VFS" to true for this file
  4. Edit the file and add the following to the very end
    Code:
    -------------------------------------------------
    -------------------------------------------------
    function OnResourceRemoved(hexPosX, hexPosY)
      local iPlayerID = Game.GetActivePlayer()    
      if (g_PerPlayerResourceTables[iPlayerID] ~= nil) then
        local gridX, gridY  = ToGridFromHex(hexPosX, hexPosY)
        local index = IndexFromGrid(gridX, gridY)
    
        DestroyResource(index)
        
        for iPlayerID, playerResourceTable in pairs(g_PerPlayerResourceTables) do
          playerResourceTable[index] = nil
        end
      end
    end
    LuaEvents.SerialEventRawResourceIconDestroyed.Add(OnResourceRemoved)
    
    -------------------------------------------------
    -------------------------------------------------
    function ResetPlayerResources(iActivePlayer)
      for index, pResource in pairs(g_ActiveSet) do
        DestroyResource(index)
      end
    
      g_PerPlayerResourceTables[iActivePlayer] = nil
    end
    LuaEvents.RIM_ResetPlayerResources.Add(ResetPlayerResources)
  5. After your pPlot:SetResourceType(-1) add
    Code:
    pPlot:SetResourceType(-1)
    LuaEvents.SerialEventRawResourceIconDestroyed(iHexX, iHexY)
    (You can use the ToHexFromGrid() function to convert between plot co-ordinates and hex co-ordinates if necessary)


The LuaEvents.RIM_ResetPlayerResources(iPlayer) event can be used to remove all resource icons for a player, useful after hiding all hexes from the player, for example, if changing their start position.