-
Notifications
You must be signed in to change notification settings - Fork 2
WebMaterials
Last updated for version v0.3.1
This is a sub-addon in VExtensions that adds webmaterials (Materials made from images on the web) to be interacted and created by E2. This allows you to put Images you find online onto props, EGP image boxes and more. (As long as they're whitelisted, see the whitelist here: url-whitelist)
This should be fully functional and safe
If you find any bugs, please report them to the Issues page.
Creates a webmaterial using the url as the image.
It is 512x512 for now, see https://github.com/Vurv78/VExtensions/issues/40 for a tracking issue on when that will be configurable.
The url cannot be longer than 2000 characters, and has to fit into the list of whitelisted URLs. See url-whitelist.
By default the delay between webmaterial creation is a flat 750 millisecond cooldown. See webMaterialCanCreate.
This is the same as doing webMaterial(url) and then running :egpImageBox(, , , ).
Uses the webmaterial and creates an EGP Box with the specified position and size, with the texture of the box set to the webmaterial.
Tries to set the material of a prop to a webmaterial.
Returns 0 or 1 for whether the material was successfully applied.
Returns whether you can create a webmaterial (If you have enough material slots to do so)
Additionally checks whether the webmaterial creation cooldown has passed
Destroys all of your owned webMaterials, in order to make more materials.
Returns the max amount of webmaterials you can own as a player. (Global across all of your E2 chips)
Returns how many webmaterials you've used up in your quota.
Returns whether this webmaterial is actually owned by you.
Webmaterials work in a way that if someone creates a material at a certain url, as an optimization, all future webmaterials will use that url
Until the person who originally created it destroys it.
Returns the original creator of the webmaterial.
This will often be owner(), but see :cached() for the situation when it is not.
Returns whether this webmaterial has been destroyed and is not able to be used.
This is not the same as an invalid webmaterial.
Attempts to destroy a webmaterial for all clients and frees up a slot for you to use another webmaterial.
This has a base 250 ms cooldown between uses.
Returns 1 or 0 for whether the webmaterial was successfully destroyed.
@name Webmaterials Prop Example
@persist P:entity M:webmaterial
# Spawns box with some beautiful rust evangelism on it
if(first()){
P = propSpawn("models/hunter/blocks/cube075x075x075.mdl",entity():pos(),ang(),0)
M = webMaterial("https://i.imgur.com/lfBBhiE.png")
interval(100)
}else{
P:setMaterial( M )
}
See more in-depth examples in our Discussions