I ran into an issue while recreating the default TTT SWEPs with ArcCW: the current code overrides SWEP.Icon no matter what.
In my use case, I had copied over SWEP.Icon = "vgui/ttt/icon_silenced", but this was being overwritten to wep.Icon = "arccw/hud/arccw_bird.png" since icon_silenced didn't match the SWEP ClassName of weapon_ttt_sipistol.
I think this solution is the most elegant - only attempt to automatically override the icon if it isn't already set. We check isstring() first because Material() requires a string for an argument (if we pass nil we get an error).
I ran into an issue while recreating the default TTT SWEPs with ArcCW: the current code overrides SWEP.Icon no matter what.
In my use case, I had copied over
SWEP.Icon = "vgui/ttt/icon_silenced"
, but this was being overwritten towep.Icon = "arccw/hud/arccw_bird.png"
sinceicon_silenced
didn't match the SWEP ClassName ofweapon_ttt_sipistol
.I think this solution is the most elegant - only attempt to automatically override the icon if it isn't already set. We check
isstring()
first becauseMaterial()
requires a string for an argument (if we passnil
we get an error).