function GoalNetUpdate(idx)
	local as = gSportsRNA
	local goalnet = as:GetTable("wvGoalNet", idx)

    db.goalnet[idx].lightType = as:GetInt(goalnet, "stadLightType")
	db.goalnet[idx].stadiumID = as:GetInt(goalnet, "stadID")

	db.goalnet[idx].netID = as:GetInt(goalnet, "netTexture") 
	db.goalnet[idx].netColorID = as:GetInt(goalnet, "colorTexture") 
	db.goalnet[idx].goalType = as:GetInt(goalnet, "goalType") 
	
	
	local stadium = as:GetTable("wvStadium", math.floor(idx/2))
	db.goalnet[idx].teamID = as:GetInt(stadium, "homeKitTeamID" )
	
end

function GoalNetAssetBind(goalnet)
	local gr = gRenderables
   	local lod = 0

	gr:AddCallback(goalnet, lod, "GoalNetUpdate(?)")
	gr:AddAsset(goalnet, lod, "shader", "data/fifarna/shader.big")
	gr:AddAsset(goalnet, lod, "nettexture", "${GetRMNetShape(?)}data/sceneassets/goalnet/goalnet_${db.goalnet[?].netID}.rx3")
	gr:AddAsset(goalnet, lod, "colortexture", "${GetRMNetColour(?)}data/sceneassets/goalnet/netcolor_${db.goalnet[?].netColorID}_textures.rx3")
	gr:AddAsset(goalnet, lod, "stadium", "data/sceneassets/stadium/stadium_${db.goalnet[?].stadiumID}.rx3")

	gr:AddAsset(goalnet, lod, "goalbase_textures", "data/sceneassets/goalnet/goalpost_${db.goalnet[?].goalType}_textures.rx3")
--	gr:SetTexture(goalnet, lod, "netmesh", "textures", "netTexture", "nettexture", "goalnet_${db.goalnet[?].netColorID}_cm.Raster")
--	gr:SetTexture(goalnet, lod, "netmesh", "textures", "colorTexture", "colortexture", "goalnet_color.Raster")

	local part = "goalpost_static"
	gr:AddAsset(goalnet, lod, part, "data/sceneassets/goalnet/goalpost_${db.goalnet[?].goalType}.rx3")
	gr:CreateMaterialFromAttribulator(goalnet, lod, part, "goalbase_material", "goalbase" )
	gr:SetSubMesh(goalnet, lod, part, "goalpost_static")
	gr:SetTexture(goalnet, lod, part, "textures", "diffuseTexture", "goalbase_textures", "goalbase_cm")
	gr:SetTextureFromRuntime(goalnet, lod, part, "textures", "coverageMap", "covmap_${db.goalnet[?].stadiumID}_${db.goalnet[?].lightType}")
	
	local part = "goalpost_slide"
	gr:AddAsset(goalnet, lod, part, "data/sceneassets/goalnet/goalpost_${db.goalnet[?].goalType}.rx3")
	gr:CreateMaterialFromAttribulator(goalnet, lod, part, "goalbase_material", "goalbase" )
	gr:SetSubMesh(goalnet, lod, part, "goalpost_slide")
	gr:SetTexture(goalnet, lod, part, "textures", "diffuseTexture", "goalbase_textures", "goalbase_cm")
	gr:SetTextureFromRuntime(goalnet, lod, part, "textures", "coverageMap", "covmap_${db.goalnet[?].stadiumID}_${db.goalnet[?].lightType}")
	
	

	return goalnet
end


function GetRMNetColour(idx)
	local netcol = ""
	netcol = netcol.."data/sceneassets/goalnet/specificnetcolor_"..db.goalnet[idx].teamID.."_"..db.goalnet[idx].stadiumID.."_textures.rx3;"
	netcol = netcol.."data/sceneassets/goalnet/specificnetcolor_0_"..db.goalnet[idx].stadiumID.."_textures.rx3;"
	netcol = netcol.."data/sceneassets/goalnet/specificnetcolor_"..db.goalnet[idx].teamID.."_0_textures.rx3;"
	netcol = netcol.."data/sceneassets/goalnet/specificnetcolor_0_0_textures.rx3;"
	return netcol
end

function GetRMNetShape(idx)
	local netcol = ""
	netcol = netcol.."data/sceneassets/goalnet/specificgoalnet_"..db.goalnet[idx].teamID.."_"..db.goalnet[idx].stadiumID..".rx3;"
	netcol = netcol.."data/sceneassets/goalnet/specificgoalnet_0_"..db.goalnet[idx].stadiumID..".rx3;"
	netcol = netcol.."data/sceneassets/goalnet/specificgoalnet_"..db.goalnet[idx].teamID.."_0.rx3;"
	netcol = netcol.."data/sceneassets/goalnet/specificgoalnet_0_0.rx3;"
	return netcol
end

--Revolution Mod 14 1.0
--Edited by scouser09
