[QUOTE=OverloadUT]
As for the problem: Are you guys getting the ghost preview when you point at a prop? I am really trying to fix the issue, but the main problem is that it works perfectly for me. I even deleted my copy and installed it from the download. Are you guys running PropDefender? Is this in single player or multiplayer?[/QUOTE]
Nope. Don't work. Singleplayer, multiplayer: Don't work.
[QUOTE=SuperV]Nope. Don't work. Singleplayer, multiplayer: Don't work.[/QUOTE]
English please. Are you saying it doesn't work in singleplayer AND multiplayer? I have confirmed that it's broken in singleplayer and am working on it now. However, it works perfectly in multiplayer for me - does it not for you? Keep in mind of course it won't work as a client in multiplayer unless the server has the stool installed.
[b]Edit:[/b]
Whew! That one was a doozie. The problem was that the stacker checks to make sure that there is no entity on the EXACT same position it is trying to stack to (so you don't accidentally create two stacks in the same place which would cause major lag) but this had an unforseen problem in singleplayer: The ghost preview was in the exact same position it was trying to stack to, so it prevented the stack from spawning! In multiplayer, the ghost entity is clientside, meaning it doesn't exist on the server which is what does the spawning; but in singleplayer there is no client<->server difference so that's why it only happened there.
Regardless:
[release][highlight]Version 2.1 Released[/highlight]
[url=http://forums.facepunchstudios.com/showthread.php?t=254916]See first post for download link[/url]
[b]Changelist[/b]
v2.1
= Fixed it so it works in singleplayer.[/release]
[lua]
TOOL.Category = "Construction"
TOOL.Name = "#Stacker"
TOOL.Command = nil
TOOL.ConfigName = ""
TOOL.ClientConVar[ "freeze" ] = "0"
TOOL.ClientConVar[ "weld" ] = "0"
TOOL.ClientConVar[ "nocollide" ] = "0"
TOOL.ClientConVar[ "mode" ] = "1"
TOOL.ClientConVar[ "dir" ] = "1"
TOOL.ClientConVar[ "count" ] = "1"
TOOL.ClientConVar[ "model" ] = ""
TOOL.ClientConVar[ "offsetx" ] = "0"
TOOL.ClientConVar[ "offsety" ] = "0"
TOOL.ClientConVar[ "offsetz" ] = "0"
TOOL.ClientConVar[ "rotp" ] = "0"
TOOL.ClientConVar[ "roty" ] = "0"
TOOL.ClientConVar[ "rotr" ] = "0"
TOOL.ClientConVar[ "recalc" ] = "0"
// Add Default Language translation (saves adding it to the txt files)
if ( CLIENT ) then
language.Add( "Tool_ol_stacker_name", "Stacker" )
language.Add( "Tool_ol_stacker_desc", "Stack props easily" )
language.Add( "Tool_ol_stacker_0", "Click to stack the prop you are pointing at." )
language.Add( "Undone_ol_stacker", "Undone Stack" )
end
function TOOL:LeftClick( trace )
if !trace.Entity then return false end
if !trace.Entity:IsValid() then return false end
if trace.Entity:GetClass() != "prop_physics" then return false end
if CLIENT then return true end
local freeze = self:GetClientNumber( "freeze" ) == 1
local weld = self:GetClientNumber( "weld" ) == 1
local nocollide = self:GetClientNumber( "nocollide" ) == 1
local mode = self:GetClientNumber( "mode" )
local dir = self:GetClientNumber( "dir" )
local count = self:GetClientNumber( "count" )
local offsetx = self:GetClientNumber( "offsetx" )
local offsety = self:GetClientNumber( "offsety" )
local offsetz = self:GetClientNumber( "offsetz" )
local rotp = self:GetClientNumber( "rotp" )
local roty = self:GetClientNumber( "roty" )
local rotr = self:GetClientNumber( "rotr" )
local recalc = self:GetClientNumber( "recalc" ) == 1
local offset = Vector(offsetx, offsety, offsetz)
local rot = Angle(rotp, roty, rotr)
-- local model = self:GetClientInfo( "model" )
-- if !model || !util.IsValidModel(model) then return false end
local player = self:GetOwner()
local ent = trace.Entity
local newvec = ent:GetPos()
local newang = ent:GetAngles()
local lastent = ent
undo.Create("ol_stacker")
for i=1, count, 1 do
if ( !self:GetSWEP():CheckLimit( "props" ) ) then break end
// ********************
// POSITION CALCULATION
// ********************
if i == 1 || (mode == 2 && recalc == true) then
// We only calculate this stuff if it's the first item in the stack OR
// if recalc is turned on
stackdir, height, thisoffset = self:OLStackerCalcPos(lastent, mode, dir, offset)
end
newvec = newvec + stackdir * height + thisoffset
newang = newang + rot
// Test to make sure this is inside the level
if !util:IsInWorld(newvec) then
break
end
// Find out if there is an entity on this spot
local entlist = ents.FindInSphere(newvec,1)
local bFound = false
for k, v in pairs(entlist) do
if v:IsValid() && v != lastent && v:GetClass() == "prop_physics" && v:GetPos() == newvec && v != self.GhostEntity then
bFound = true
end
end
if bFound then break end
newent = ents.Create("prop_physics")
newent:SetModel(ent:GetModel())
newent:SetColor(ent:GetColor())
newent:SetPos(newvec)
newent:SetAngles(newang)
newent:Spawn()
if freeze then
newent:GetPhysicsObject():EnableMotion( false )
end
if weld then
local weldent = constraint.Weld( lastent, newent, 0, 0, 0 )
undo.AddEntity( weldent )
end
if nocollide then
local nocollideent = constraint.NoCollide(lastent, newent, 0, 0)
undo.AddEntity( nocollideent )
end
lastent = newent
undo.AddEntity( newent )
player:AddCount( "props", newent )
player:AddCleanup( "props", newent )
if PropDefender && PropDefender.Player && PropDefender.Player.Give then
PropDefender.Player.Give(player, newent, false)
end
end
undo.SetPlayer( player )
undo.Finish()
return true
end
function TOOL:OLStackerCalcPos(lastent, mode, dir, offset)
local forward = Vector(1,0,0):Angle()
local pos = lastent:GetPos()
local ang = lastent:GetAngles()
local lower, upper = lastent:WorldSpaceAABB( )
local glower = lastent:OBBMins()
local gupper = lastent:OBBMaxs()
local stackdir = Vector(0,0,1)
local height = math.abs(upper.z - lower.z)
if mode == 1 then // Relative to world
if dir == 1 then
stackdir = forward:Up()
height = math.abs(upper.z - lower.z)
elseif dir == 2 then
stackdir = forward:Up() * -1
height = math.abs(upper.z - lower.z)
elseif dir == 3 then
stackdir = forward:Forward()
height = math.abs(upper.x - lower.x)
elseif dir == 4 then
stackdir = forward:Forward() * -1
height = math.abs(upper.x - lower.x)
elseif dir == 5 then
stackdir = forward:Right()
height = math.abs(upper.y - lower.y)
elseif dir == 6 then
stackdir = forward:Right() * -1
height = math.abs(upper.y - lower.y)
end
elseif mode == 2 then // Relative to prop
forward = ang
if dir == 1 then
stackdir = forward:Up()
offset = forward:Up() * offset.X + forward:Forward() * -1 * offset.Z + forward:Right() * offset.Y
height = math.abs(gupper.z - glower.z)
elseif dir == 2 then
stackdir = forward:Up() * -1
offset = forward:Up() * -1 * offset.X + forward:Forward() * offset.Z + forward:Right() * offset.Y
height = math.abs(gupper.z - glower.z)
elseif dir == 3 then
stackdir = forward:Forward()
offset = forward:Forward() * offset.X + forward:Up() * offset.Z + forward:Right() * offset.Y
height = math.abs(gupper.x - glower.x)
elseif dir == 4 then
stackdir = forward:Forward() * -1
offset = forward:Forward() * -1 * offset.X + forward:Up() * offset.Z + forward:Right() * -1 * offset.Y
height = math.abs(gupper.x - glower.x)
elseif dir == 5 then
stackdir = forward:Right()
offset = forward:Right() * offset.X + forward:Up() * offset.Z + forward:Forward() * -1 * offset.Y
height = math.abs(gupper.y - glower.y)
elseif dir == 6 then
stackdir = forward:Right() * -1
offset = forward:Right() * -1 * offset.X + forward:Up() * offset.Z + forward:Forward() * offset.Y
height = math.abs(gupper.y - glower.y)
end
-- offset = (stackdir:Angle():Up() * offset.Z) + (stackdir:Angle():Forward() * offset.X) + (stackdir:Angle():Right() * offset.Y)
end
return stackdir, height, offset
end
function TOOL:RightClick( trace )
return self:LeftClick( trace )
// Maybe I'll add this later...
/*
if !trace.Entity then return false end
local ent = trace.Entity
local ply = self:GetOwner()
if ent:GetClass() != "prop_physics" then return false end
local model = ent:GetModel()
if !model then
ply:ConCommand("ol_stacker_model \"\"\n")
else
ply:ConCommand("ol_stacker_model "..model.."\n")
end
return true
*/
end
function TOOL.BuildCPanel( CPanel )
// HEADER
CPanel:AddControl( "Header", { Text = "#Tool_ol_stacker_name", Description = "#Tool_ol_stacker_desc" } )
CPanel:AddControl( "ComboBox", { Label = "#Presets", MenuButton = "1", Folder = "ol_stacker", Options = {
Default = {
ol_stacker_freeze = "0",
ol_stacker_weld = "0",
ol_stacker_nocollide = "0",
ol_stacker_mode = "1",
ol_stacker_dir = "1",
ol_stacker_count = "1",
ol_stacker_model = "",
ol_stacker_offsetx = "0",
ol_stacker_offsety = "0",
ol_stacker_offsetz = "0",
ol_stacker_rotp = "0",
ol_stacker_roty = "0",
ol_stacker_rotr = "0",
ol_stacker_recalc = "0"
} }, CVars = {
"ol_stacker_freeze" ,
"ol_stacker_weld",
"ol_stacker_nocollide",
"ol_stacker_mode",
"ol_stacker_dir",
"ol_stacker_count",
"ol_stacker_model",
"ol_stacker_offsetx",
"ol_stacker_offsety",
"ol_stacker_offsetz",
"ol_stacker_rotp",
"ol_stacker_roty",
"ol_stacker_rotr",
"ol_stacker_recalc" } } )
CPanel:AddControl( "Checkbox", { Label = "Freeze Props", Command = "ol_stacker_free
I'd say that this is easily one of the most useful STools out there. I use this in nearly everything I build.
I meant to add the presets thing on this last version I released, I just totally forgot. :v:
litghost, the code you posted is modified from the very first version released. So if anyone uses that, don't complain that the new features are missing! ;)
[QUOTE=OverloadUT]I meant to add the presets thing on this last version I released, I just totally forgot. :v:
litghost, the code you posted is modified from the very first version released. So if anyone uses that, don't complain that the new features are missing! ;)[/QUOTE]
That is kind of funny, this what was in your "pack" I got today. Might want to update that, or atleast warn that some are out of date.
:EDIT: Replace lua with right version, with Presets.
[QUOTE=litghost]That is kind of funny, this what was in your "pack" I got today. Might want to update that, or atleast warn that some are out of date.
:EDIT: Replace lua with right version, with Presets.[/QUOTE]
Ah yes I haven't updated the pack yet. I like to release the individual STools and have them be out for a day or two before I update the pack. That way problems like this single player bug won't make its way in to the pack. I like the pack to be a nice worry free package. :)
lua king
yeah baby
how do u weld them all together is there a special button or something?..
[QUOTE=saiyanbob666]how do u weld them all together is there a special button or something?..[/QUOTE]
I've gotten used to people not reading the manual, but come on, this one is right there in the [url=http://www.apartment167.com/otherimages/garrysmod/ol_stacker.JPG]screenshot![/url]
ok I was retarded and didn't see it ...well on another note i get a hl2.exe send error when I stack to many things and it boots me out of the game
[QUOTE=saiyanbob666]ok I was retarded and didn't see it ...well on another note i get a hl2.exe send error when I stack to many things and it boots me out of the game[/QUOTE]
I get kicked out of my own Dedicated server with the hl2.exe crash as well, and when I rejoin and look at the stacked objects it crashes again.
I can never continue the work on it because it crashes when I point towards the objects.
Not sure if it's a stacker problem though or just a "your crap computer can't handle this much stuff" problem.
yea lol
hey could you make it so that you can go pos AND neg on the yaw pitch and roll thingys?
[QUOTE=thecaretaker]hey could you make it so that you can go pos AND neg on the yaw pitch and roll thingys?[/QUOTE]
It used to be that way, but it was redundant. -90 degrees == 270 degrees.
If you really want to go negative though, simply type in a negative number.
Edit: Yeah, for the XYZ offsets, I'll make it to negative next version. For now though, just type it in.
[QUOTE=thecaretaker]hey could you make it so that you can go pos AND neg on the yaw pitch and roll thingys?[/QUOTE]
Roll is not so much a problem, -10deg = 350deg.
But for negative direction you have to type it in. This would be good to have negative on the slider.
[b]Edit:[/b]
LOL Jinx :-P
Would be good to have a option for a perfect mirrored stack.
Hmmph, small problem, I make a box-fort with this, and by the time It's about 10 boxes high 10 boxes wide, I crash. However if I don't use the stacker I don't crash at all.
[QUOTE=PsiSoldier]Hmmph, small problem, I make a box-fort with this, and by the time It's about 10 boxes high 10 boxes wide, I crash. However if I don't use the stacker I don't crash at all.[/QUOTE]
Are you having all of them weld and nocollide? Those add significantly more constraints to the world and can crash if your machine isn't good enough for what you're building.
If you only check "Freeze" them you can make significantly more props without problem.
[b]Edit:[/b]
[QUOTE=seiken]Would be good to have a option for a perfect mirrored stack.[/QUOTE]
Please explain.
Couldn't you spawn a box, then use the stacker to create 1 box 500 units to the "left", then use the stacker to create stacks of 10 on top of each one? Perfectly mirrored stack.
I'd suggest a stack button in the interface menu. Just select every prop with the toolgun, then set the options and then press the stack button.
[QUOTE=AzKika]I'd suggest a stack button in the interface menu. Just select every prop with the toolgun, then set the options and then press the stack button.[/QUOTE]
Why would that be better? It requires more button presses to accomplish the same thing.
Well looks like you're right. (Note to myself: Think next time...)
-Snip-
This has made building forts 10 times faster and more detailed then ever. This is the best Stool around. The only problem is people spamming explosive barrels.
But that is easily fix with kick mingebag command.
You create some excellent tools OverloadUT thanks a lot :D
Man, that's so useful! Lua King'd.
This has got to be the most essential tool for any fort building!
Stacker is now broken with the new update, by the way. Any way to fix it?
I have to thank you for such a awesome tool. I use it everytime i enter gmod. I love it to death :D
Broke after last update for many. Can you have a look at it when you get the time?
Sorry, you need to Log In to post a reply to this thread.