Improved Stacker Tool[/thumb]

Available on:

What is the Stacker Tool?
The Stacker Tool can be used to easily stack props in various directions and angles. It is one of the most common building tools for Sandbox servers.

How does Improved Stacker compare to the original Stacker Tool?
The Improved Stacker tool is a complete rewrite of the original Stacker tool and includes many bug fixes and new features that both clients and server owners can benefit from.
Unlike the other versions of the tool, the Improved Stacker tool is also currently being actively maintained.

What is new about Improved Stacker?

1.) Improved Stacker addresses several prominent crashes and bugs:

• Prevented a crash from players using very high X/Y/Z offset values.
• Prevented a crash from players using very high P/Y/R rotate values.
• Prevented a crash from very specific constraint settings.
• Fixed applying halos to ghosted props and fixed the massive FPS drop they were previously causing
• Fixed material and color saving when duping stacked props.
• Fixed incorrect stack angles when trying to create a stack on an existing stack.
• Fixed incorrect stack angles when stacking in a direction other than Front

2.) Improved Stacker added support for new functionality that can greatly improve your building experience:

• Added support for applying materials to the stacked props (toggleable)
• Added support for applying colors to the stacked props (toggleable)
• Added support for applying skins to props with multiple skins (automatic)
• Added support for applying physical properties (gravity, physics material) from the Physical Properties tool to the stacked props (toggleable)
• Added support for applying weight to the stacked props (toggleable, under Physical Properties)
• Added a toggleable axis and axis labels for showing a prop’s orientation
• Added presets functionality to save your settings so you can reuse them
• Added language support (like with my Improved Weight tool)
• Switched over to the new tool HUD style
• Added more control via key combinations:

    • Right-click creates a single prop in the stack
    • Shift (or E) + Left-click increases the stack size
    • Shift (or E) + Right-click decreases the stack size, and Reload ® changes the stack direction

3.) Improved Stacker caters to developers and server admins:

• Added easy access to admin settings via an in-game Utilities menu

• Added console variables that server operators can control from console:

stacker_improved_max_per_player         -inf/inf (less than 0 == no limit)
stacker_improved_max_per_stack          -inf/inf (less than 0 == no limit)
stacker_improved_max_offsetx            -inf/inf
stacker_improved_max_offsety            -inf/inf
stacker_improved_max_offsetz            -inf/inf
stacker_improved_force_stayinworld         0/1
stacker_improved_force_weld                0/1
stacker_improved_force_freeze              0/1
stacker_improved_force_nocollide           0/1
stacker_improved_force_nocollide_all       0/1
stacker_improved_delay                     0/inf

• Added console commands that server admins can control from in-game:

stacker_improved_set_max_per_player     -inf/inf (less than 0 == no limit)
stacker_improved_set_max_per_stack      -inf/inf (less than 0 == no limit)
stacker_improved_set_maxoffset          -inf/inf
stacker_improved_set_maxoffsetx         -inf/inf
stacker_improved_set_maxoffsety         -inf/inf
stacker_improved_set_maxoffsetz         -inf/inf
stacker_improved_set_force_stayinworld     0/1
stacker_improved_set_weld                  0/1
stacker_improved_set_freeze                0/1
stacker_improved_set_nocollide             0/1
stacker_improved_set_nocollide_all         0/1
stacker_improved_set_delay                 0/inf

• Added Stacker hooks to support external prop protections/anti-spam addons:

StackerEntity has been added to allow servers to control over each entity that the player spawns within a stack. This allows you to write your own logic, like assigning prop ownership, handling anti-spam, etc.

hook.Add( "StackerEntity", "Test", function( ent, owner )
    -- returning any value other than nil will stop the current stack, so it is your responsibility to remove the entity
    -- this hook will be executed directly after the entity has been created with ents.Create( "prop_physics" )

    -- for example, to prevent players from stacking a specific model, you could do the following:
    if ( ent:GetModel() == "some/bad/model.mdl" ) then
        ent:Remove() -- you have to manually remove the prop yourself
        return false -- returning false (or anything non-nil) will prevent any more props in the stack from being created
end )

StackerMaxPerStack has been added to allow servers to control the maximum number of props a player can stack (independent from the improved_stacker_max_per_stack cvar). This allows you to write your own logic for stack sizes (e.g., you can make it team based or job based).

hook.Add( "StackerMaxPerStack", "Test", function( ply, count, isRightClick )
    -- returning a number here will determine the maximum amount of props a player can used per stack

    -- for example, to allow players in the Admin usergroup to spawn to an infinite amount, return -1
    if ( ply:IsAdmin() ) then return -1 end
end )

StackerMaxPerPlayer has been added to allow servers to control the maximum number of Stacker entities a player can have spawned out at any given time (independent from the improved_stacker_max_per_player cvar). This allows you to write your own logic.

hook.Add( "StackerMaxPerPlayer", "Test", function( ply, numSpawned )
    -- returning a number here will determine the total number of Stacker entities a player can have spawned out at any given time

    -- for example, this will allow players in the Admin usergroup to spawn an infinite amount of Stacker entities, while making everyone else use the server's improved_stacker_max_per_player setting
    return ply:IsAdmin() and -1 or nil
end )

StackerDelay has been added to allow servers to control the delay (in seconds) between a player’s usage of the Stacker tool. This allows you to write your own logic for delay times.

hook.Add( "StackerDelay", "Test", function( ply, lastStackTime )
    -- returning a number here will determine the number of seconds that must pass before the player can use Stacker
    -- for example, this will allow players in the Admin usergroup to use the tool with no delay, while everyone else must wait 1 second between each tool use
    return ply:IsAdmin() and 0 or 1
end )

StackerConVar has been added to allow servers to control which players can change Stacker convars. This allows you to write your own logic.

hook.Add( "StackerConVar", "Test", function( ply, cmd, arg )
    -- returning a value here will determine whether the player is allowed or blocked from changing the cvar (cmd)
    -- return true:  allow them
    -- return false: block them
    -- return nil (default): fallback to a ply:IsAdmin() check

    -- for example, this will prevent anyone except for players in the Super Admin usergroup from changing the settings,
    -- rather than just default to a ply:IsAdmin() check
    return ply:IsSuperAdmin()
end )

OverloadUT (STEAM_0:1:5250809) – Wrote the original Stacker Tool back in 2006 (release thread)
Marii (STEAM_0:1:16015332) – Updating OverloadUT’s Stacker Tool for GMod 13, also being the starting code for Improved Stacker

Please DO NOT reupload this tool (verbatim or small tweaks) to the workshop or other public file-sharing websites.
I actively maintain this tool, so reuploading it may lead to people using outdated, buggy, or malicious copies.
If there is an issue with the tool, LET ME KNOW via one of the following pages:


- May 27th, 2014 :: Added to GitHub
- May 28th, 2014 :: Added to Workshop
- Jun 5th,  2014 :: Massive overhaul
- Jul 24th, 2014 :: Large update
- Aug 12th, 2014 :: Optimizations
- Jun 30th, 2015 :: Bug fixes/features
- Jul 11th, 2015 :: Bug fixes
- Oct 26th, 2015 :: Bug fixes
- Aug 3rd,  2016 :: Bug fixes
- Aug 31st, 2016 :: Bug fixes
- Sep 2nd,  2016 :: Added Bulgarian language support





This actualy looks really good !

A lot of servers these days wouldn’t get stacker tool because of the crashing, Lets hope this does actually fix it.

I have to apologize, there appears to be a problem with the PreDrawHalos hook that draws the halos on the stacked props, causing the tool to spam errors when the player is dead.

This is only occurring because I released a rather large update on the tool at the same time as posting this. I am addressing the bug, so please bear with me.


[editline]5th June 2014[/editline]

A small update has been released that addresses this issue. I apologize for any inconvenience caused by the errors.

Kudos for writing human-readable code, unlike every other Stacker tool I had to deal with. :v:

Thank you!

Nearly every tool I have seen is written in the exact same unreadable/messy way, so I am doing my best to clean things up and write them the way I wish all tools were organized as.

Can you add a for player spawn prop?

A majority of prop limitation addons rely on that hook to be called to limit the player’s prop limit, this voids that.

Hey I have an issue with this addon, I installed it and it shows up ingame. Some props create the holo (not all of them) But when I left click to stack nothing happens. Does not matter how many props I tell it to stack. This is on a darkrp server.

Hello, insanekid2. I apologize for the late response.

I’ve added both the PlayerSpawnProp and PlayerSpawnedProp hooks. You can find more information in this thread where someone else suggested roughly the same thing:

We’re currently discussing this over the workshop page. Here is a transcript:

If anyone else is having this issue and can find a way to replicate it, please inform me as soon as possible! Thanks.

The problem with most servers that have Stacker (95% of all DarkRP and Sandbox servers) is that if you take a wooden, breakable prop and stack the prop on top of itself multiple times (30-50 times) and unfreeze them all at once, the server just stops working.
Does this fix that?

Welcome to Source collision.

It’s fun to mess with servers that have Stacker by using that exploit though.

It’s not really an “exploit” when you can manually do the same thing by dropping tons of wood panels on top of each other or dropping a bunch of money props in a corner.

I had the issue before you pushed the last update for the prop limit check. (which works perfect thanks!)

After that update it seems to work fine now but I can still partially explain what the issue was.

  1. The Stacker tool was not emitting any errors.
  2. I was unable to stack any prop but the holo prop showed up. <— this is just an example, it stacks fine now for me.
  3. This happened for me on both singleplayer and multiplayer. I had the github addon format that I tested for singleplayer and then I used the workshop version for multiplayer.

Again, this problem does not happen for me anymore since the last update and I have tested it in both singleplayer/multiplayer with both github addon format and workshop version.

I’ve updated the Improved Stacker. Here is a transcript from the workshop page:

As usual, please post any issues you have here or at the GitHub page. Thanks!

This might be a little extreme of a suggestion, but stacker is often the most abuse tool on my server. Users would enter the server and stack a column of chairs, and unfreeze it. The result would be a mass of physics lag.

Is there possible any solution to this? Other than limiting the usage of the tool, which I would hate to do.

Yeah, we suffer from the same issue.

Would it be possible to notify admins if player is spawning masses of props with the stacker tool?

I think just about any server with the stacker tool has this issue. It is really troublesome, what I generally do to combat it currently is use Falco’s Prop Protection, and set some sensitive anti-spam settings, so I have a few seconds to see if they keep spawning a mass of props. If I notice the lerp is flashing yellow, I clear that player’s entities.

I’ve taken the stacker spamming issue into consideration and decided the least intrusive way I could do it was to add a cvar that you can use to determine the delay between using stacker.

From the server console: stacker_delay #
From a server admin’s console: stacker_set_delay #

The default value is 0, which is the normal behavior prior to this update (you can use it as quickly as you want). If you want there to be a 3 second delay in between stacker uses, you can use stacker_delay 3.

Even a delay of 1 second should help a decent amount.

I’ve also added the following 3 cvars:

stacker_force_freeze < 0 / 1 >
stacker_force_weld < 0 / 1 >
**stacker_force_nocollide **< 0 / 1 >

And 3 concommands for server admins:
stacker_set_freeze** < 0 / 1 >
stacker_set_weld < 0 / 1 >
stacker_set_nocollide < 0 / 1 >

When either of these are set to 1, it will force the corresponding setting to always be enabled. For example, if you want to force players’ stacked props to be nocollide regardless of their setting, you can use stacker_force_nocollide 1. Setting it back to 0 will allow clients to use their own settings again.

These values are all 0 by default like the stacker delay so that you must change the values yourself.

I hope this helps address the spamming/lagging issues discussed in this thread and the workshop page. If you have any issues, please post them here or on the GitHub page.

Works perfectly, good job