Skip to content

Commit

Permalink
Add entity modifiers for e2 material setting
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrb93 committed Nov 25, 2018
1 parent 678eaca commit 54712f2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/entities/gmod_wire_expression2/core/e2lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ E2Lib.setPos = WireLib.setPos
E2Lib.setAng = WireLib.setAng

function E2Lib.setMaterial(ent, material)
ent:SetMaterial(WireLib.IsValidMaterial(material))
material = WireLib.IsValidMaterial(material)
ent:SetMaterial(material)
duplicator.StoreEntityModifier(ent, "material", { MaterialOverride = material })
end

function E2Lib.setSubMaterial(ent, index, material)
ent:SetSubMaterial(index,WireLib.IsValidMaterial(material))
index = math.Clamp(index, 0, 255)
material = WireLib.IsValidMaterial(material)
ent:SetSubMaterial(index, material)
duplicator.StoreEntityModifier(ent, "submaterial", { ["SubMaterialOverride_"..index] = material })
end

-- getHash
Expand Down

0 comments on commit 54712f2

Please sign in to comment.