STOOL: Unbreakable

[release]Installation
http://www.garrysmod.org/img/?t=dll&id=4484unzip in your garrysmod/addons folder
[/release]

[release]Features
[ul]Left click make aimed prop unbreakable[/ul]
[ul]Right click restore aimed prop settings[/ul]
[ul]Make an entire contraption breakable/unbreakable in one click[/ul]
[/release]

[release]Informations
[ul]I didn’t found anywhere a stool like that, that’s why I decide to make one and release it[/ul]
[ul]I don’t understand why I didn’t found a stool like this, because it’s very useful when we make contraption with wood… :D[/ul]
[ul]Because I didn’t find in the wiki how to easily script that, I used a little hack I found for my prop protection. But like comments says in the garrysmod code… welcome to gmod! :D[/ul]
[ul]Works perfectly with Prop protection addon[/ul]
[ul]Don’t forget to rate it if you like it![/ul]
[ul]I’m french, so rating me awful spelling is very easy, I try to do my best in english, remember that[/ul]
[/release]

[release]Screenshot

http://www.garrysmod.org.nyud.net:8080/img/dl/4484_1.jpg

[/release]

[release]Changelog

Version 1.1
[ul][Added] Extend to contrained objects[/ul]
[ul][Changed] Protection system (thanks Spoco)[/ul]
[/release]

Nice, clean, simple and works like a treat. Well done.

This is especially useful to me as I have disabled the magnetise tool (as it too makes things unbreakable, albeit with a few nasty side effects) due to it breaking ULX’s jail function.

Keep up the good work Chaussette.

awesome, really useful

Wow, looks cool. Now all we need is a stool that makes everything breakable. :smiley:

Hmm why not !

You give me an idea: I can add two buttons ‘Make all entities unbreakable’
and ‘Make all entities breakable’ on the tool’s panel.

But if i do that, i must keep the compatibility with my prop protection! :smiley:

I’ll think about that

Wow, awesome, thank you, that tool is pretty use full

Nice. A lot better than using magnetise for it, since magnetise removes all constraints from the prop.

Very useful.
Now i can build wooden cars without people killing them with nades.

There is still entities we can destroy: entities spawned by stools, like balloons but it’s a bug from garrysmod and I reported it.

I’ve always used magnetize simply because there was no official stool for my needs. Thanks a bunch for this.

Well there is the health STool. You can make unbreakable props with that too.

I have a better way to make entities unbreakable, unignitable and unresponsive to explosions (Won’t be moved by explosions. Bad in some cases though.). The way is to use filter_activator_name entity and the Negated flag.

I’ve been using this for a long time (even back in GMod 9):
[lua]

local function DamageFilter() --This function creates the entity
if DmgFilter then return end --Let’s not create it twice
DmgFilter = ents.Create(“filter_activator_name”)
DmgFilter:SetKeyValue(“targetname”, “DmgFilter”)
DmgFilter:SetKeyValue(“negated”, “1”) --Negate it so, everything that would normally hurt, will not pass this filter
DmgFilter:Spawn()

print("DmgFilter entity created")

end
hook.Add(“Initialize”, “DamageFilter”, DamageFilter) --This is so it will be created when the map starts

local function MakeInvincible(pl) --This makes an entity invincible
local Ent = pl:GetEyeTrace().Entity
if not Ent:IsValid() then return end
if not DmgFilter then DamageFilter() if not DmgFilter then return end end --In case it doesn’t exist, attempt to create it
Ent:Fire(“setdamagefilter”, “DmgFilter”, 0); --It’s this simple, just make it use the filter entity we created
end
concommand.Add(“invincible”, MakeInvincible)

local function MakeUnInvincible(pl) --This makes an entity breakable again
local Ent = pl:GetEyeTrace().Entity
if not Ent:IsValid() then return end
if not DmgFilter then DamageFilter() if not DmgFilter then return end end
Ent:Fire(“setdamagefilter”, “”, 0);
end
concommand.Add(“uninvincible”, MakeUnInvincible)

[/lua]

They will be only breakable by lasers (at least that was the case in GMod 9), and I think there might be a way around that using the other filter entities http://developer.valvesoftware.com/wiki/Filter.

They are also still ignitable by the ignite tool for some reason, but they won’t be ignited by explosions.

This also works for balloons, so I think you should use my method.

Yes, but I just want to make props unbreakable, so if there is an explosion near, it’s normal they move, but they don’t break.

And even if the ignite tool works on entities unbreakable, you’ll notice that the fire don’t break them.

And I included an undo system with the right click. With your method, it’s not possible, because even if entity:SetKeyValue(…) exists, the function entity:GetKeyValue(…) doesn’t exists for the moment, so I can’t restore exactly entity’s previous settings…

Before I make this tool, i read the source sdk documentation to see if there is a simple way to make props unbreakable. that’s why I used a little ‘hack’ to do that.

But on my prop protection script, entities are not responsible to explosions (if explosions are not caused by the owner, of course)

Yes I know that, and that’s how it should to be. But if explosions ignited them, someone could cause lots of lag by igniting all of your props with dynamites or such.

No keyvalues have been changed. With right-click you simply make the entity not use the damage filter entity, just like I did in my example code.

If there’s even a better way, I want to know about it.

Okay, I’ll try that!

Just pick the magnitise stool and set everything to 0, and the prop will be unbreakable.

And, will also lose all constraints. So, what if you had a wooden car and you wanted to make it invincible? You couldn’t, or the car would fall apart.

I agree! Additionally (maybe as a separate tool) it would be neat to have a “Make all breakable” tool that makes everything constrained to an object breakable. Then we could make destructible contraptions easily :slight_smile:

Okay !

I’ll do that for the next update! :smiley:

you should have a slider where you can set how much weight it can take!
That would be cool