Garry's Mod

Garry's Mod

Not enough ratings
E2/Wire Prop Health & Damage
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build, Realism
File Size
Posted
Updated
258.685 KB
27 Apr, 2022 @ 12:29pm
27 Feb, 2023 @ 4:23pm
64 Change Notes ( view )

Subscribe to download
E2/Wire Prop Health & Damage

In 1 collection by WFL
AVBS Collection
49 items
Description
An E2 based prop damage system, similar to extended prop damage but based almost entirely within E2. Allows props or entire contraptions to be given health and take damage, break constraints depending on damage taken, and emit particles or change colour depending on impact location.

________________________________________

E2 Functions:

entity:registerDamageMonitor() - Registers a damage monitor on an entity. This is required to set health/color etc.
entity:removeDamageMonitor() - Removes a damage monitor from an entity.

entity:getEntityDamage() - Gets the damage of the last hit on the entity.
entity:getTotalEntityDamage() - Gets the total damage done to the entity since monitoring was started.
entity:getEntityDamagePercent() - Gets the percentage of damage done that is needed to break the entity.
entity:getEntityDamagePosition() - Gets last position (vector) of damage done to the entity.
entity:getDamageInflictor() - Gets the entity that did damage to the monitored entity.
entity:getDamageInflictorPosition() - Gets the position of the entity that did damage to the monitored entity.
entity:getEntityHealth() - Gets the starting health of the entity.
entity:getEntityHealthVector() - Returns a vector of Original health/Current health/Constraint break health

entity:setDamageParticleEffect(string effect) - Sets the impact particle effect (ParticleEffect)
entity:setDamageParticleEffectThreshold(int damage, string effect) -- Sets the impact particle effect to trigger after a set damage threshold.
entity:setDamagePropHealth(int health) - Sets the entities' health, independent of it's mass.
entity:setDamagePropSound(string sound) - Sets the sound to play when the entity is destroyed.
entity:setDamagePropColor(vec color) - Sets the color for the entity to turn when being damaged.
entity:setDamageMultiplier(int multiplier) - Sets the damage multiplier for this entity to inflict on other entities.

damageEmitParticleEffect(string effect, vector position, angle direction, entity parent) - emits a particle effect at a location/direction.
________________________________________

entity:registerGlobalDamageMonitor(int health, string particleeffect, string soundeffect, vec damagecolor) - This function applies recursively to all props constrained to the entity given.

health: 1 or 0, whether the entity should have health or not. Health is set according to mass (see wpd_masshealthratio).

particleeffect: string, the particle effect to play on damage location.
soundeffect: string, the sound to play when the entity is destroyed.
damagecolor: vec, the RGB color to turn the prop as it is being damaged.

________________________________________

An example would be: Entity:registerGlobalDamageMonitor(1,"slime_splash_01","garrysmod/ui_click.wav",vec(255,0,0))

________________________________________

Gobal ConVars:

wpd_constraintbreakratio "100" - What percentage of health should constraints break, i.e. 30 would break constraints after 30% of the total health was done as damage.

wpd_masshealthratio "1" - Mass to health ratio. Defaults to 1, setting it higher gives props more health if their health is being set by their mass (see registerGlobalDamageMultiplier)


wpd_setdefault_enable <1/0>: Adds damage monitors to entites by default. 0/1
wpd_setdefault_health <number>: Sets global default health multiplier.
wpd_setdefault_particleeffect <string>: Sets global default particle effect.
wpd_setdefault_soundeffect <string>: Sets global default sound effect.
wpd_setdefault_color_r <0-255>: Sets global default damage color (red)
wpd_setdefault_color_g <0-255>: Sets global default damage color (green)
wpd_setdefault_color_b <0-255>: Sets global default damage color (blue)
wpd_destroyonbreak <1/0> Whether to delete props when they reach 0 health.
wpd_setdefault_worldeffect <string> The particle effect to play on impact with the world. Blank defaults to the prop's particle effect.
3 Comments
Kerk 24 Jun, 2023 @ 11:22am 
10 out of 10 addon nonetheless!
Kerk 24 Jun, 2023 @ 11:21am 
Should add a e2 function that resets the health of a damage monitor
Sanders 15 Jun, 2022 @ 6:59pm 
could you change the texture to something like acf? or give us the option to least change the texture?