Zet0rz / nzombies

A GM13 Nazi Zombies style (WIP) gamemode
GNU General Public License v3.0
73 stars 79 forks source link

Invisible Walls Collision Upgrades #166

Open Zet0rz opened 8 years ago

Zet0rz commented 8 years ago

I'm not sure if this is even possible as we don't have any player_clip collision groups, but there should be a way, possibly with a ShouldCollide hook. We'll also want bullets to go through them if they don't already too. Finally, we want them to be lockable like normal doors, which will cause them to no longer block players when opened. Since they cannot be hit by traces and bullets, they won't be able to be bought by themselves, but can be opened together with another prop of the same link.

OctothorpeObelus commented 8 years ago

Bullets do not travel through invisible walls. Did a test just now (Who needs a gui xD).

jaxjaxk commented 8 years ago

add "self:SetCustomCollisionCheck(true)" to initialize()

then add this somewhere in the file hook.Add("ShouldCollide", "spawnwallcollide", function(ent1, ent2) if ent1:GetClass() == "wall_block" and (nzConfig.ValidEnemies[ent2:GetClass()]) then if IsValid(ent1) then ent1:SetSolid(SOLID_NONE) timer.Simple(0, function() if ent1:IsValid() then ent1:SetSolid(SOLID_VPHYSICS) end end) end return false elseif ent1:GetClass() == "wall_block" and ent2:IsPlayer() then ent1:SetSolid(SOLID_VPHYSICS) return true end if ent2:GetClass() == "wall_block" and (nzConfig.ValidEnemies[ent1:GetClass()]) then if IsValid(ent2) then ent2:SetSolid(SOLID_NONE) timer.Simple(0, function() if ent2:IsValid() then ent2:SetSolid(SOLID_VPHYSICS) end end) end return false elseif ent2:GetClass() == "wall_block" and ent1:IsPlayer() then ent2:SetSolid(SOLID_VPHYSICS) return true end end)

jaxjaxk commented 8 years ago

this let's zombies through but not players. it is based off of what you have with barriers but a few changes. like the barriers players can get through if they try to force them self, a zombie is going through and they get a bit lucky. i do not think their is a better way unless you want to use what hammer does for player-noclip areas.

as for unlock like a door.... no idea why you want this but you are on your own with that part.

Zet0rz commented 8 years ago

this let's zombies through but not players.

It has, like you say, the problem same problem with barricades that players can sneak through while it is non-solid. For barricades it typically doesn't matter as zombies block the barricade in the mean time, but for invisible walls, they can be much bigger and easily allow players to pass besides zombies. I will wanna look into other ways to do this.

as for unlock like a door.... no idea why you want this

If you use a pile of props as a door, you can sometimes still jump over them. A simple invisible wall as a door would work very well here.

jaxjaxk commented 8 years ago

@Zet0rz

If you use a pile of props as a door, you can sometimes still jump over them. A simple invisible wall as a door would work very well here.

i blame the person who made the prop door. you should worry more on pressing issues than making things idiot proof.

this let's zombies through but not players.

if you want an absolute fix i have an idea. effectively while the GM creates the invisible walls have it make the walls divided up into smaller walls ( about 1/4 the width of a player would do) then use the code i have given you. effectively the only part that players will be able to get through would be the literal part the zombie is going through so they will never be able to get through ever.

now i know this would be hard to pull off. i am just giving you an idea.

OctothorpeObelus commented 8 years ago

Assign the following textures based on that props setting. To let npcs through but not players: tools/toolsplayerclip To let players through but not npcs: tools/toolsnpcclip To not let players nor npcs through: tools/toolsclip Those textures exist inside of hammer, so maybe an .fgd would work? Otherwise a program like GCFScape would be required to have those textures in master-workshop. It determines this with textures because it checks the textures name for any special properties.

Zet0rz commented 8 years ago

i blame the person who made the prop door. you should worry more on pressing issues than making things idiot proof.

With most invisible walls you can climb them in some way, and building them specifically to prevent that can ruin the design. Say if you want a barbed wire gate, you'll need two of them on top of each other to prevent climbing (and that just looks bad). That being said, I think the Invisible Blocks can actually be used with the Door Locker tool already, so this may not be needed after all.

Assign the following textures based on that props setting.

For one, I don't think these textures exist in the actual game. Secondly, they are only used in Hammer during compiling and are effectively removed during the compiling. I'm fairly sure you won't be able to use them in-game, even if they do exist there. They'll just be a literal texture. Thirdly, a .fgd imports stuff into Hammer, not into the game.

effectively while the GM creates the invisible walls have it make the walls divided up into smaller walls ( about 1/4 the width of a player would do)

That's just poorly optimized. The ShouldCollide hook is an expensive and risky hook, you have a high risk of breaking the physics engine (trust me, I've encountered this so many times). Also for what you're saying, you can just place barricades with no planks and no jump animations and it'd be the same.

OctothorpeObelus commented 8 years ago

Also for what you're saying, you can just place barricades with no planks and no jump animations and it'd be the same.

Oh yeah. Barricades without planks dont allow players to go through, but it does allow zombies to go through. Just gotta figure out how to reverse it (it's probably way easier than it sounds to me).

Zet0rz commented 8 years ago

reverse it

Reverse it? Reverse what?

OctothorpeObelus commented 8 years ago

(If for some reason...) Reverse the mechanic of the barricade as an option in invisible wall placer tool so that players can walk through but zombies can't. I don't know why we'd need this, but it could come in handy eventually.

P.S. Since there are 39 issues in Workshop Release milestone, here is the math: 39 * 2.56410257 I kinda felt like finding that number without a calculator. This adds up to 100 exactly. Don't mention this bit though xD

jaxjaxk commented 8 years ago

@ScriptnLua that's what i did. the barricade wall does the exact same thing i proposed but as Zer0rz pointed out the should collide hook is a pain in the ass and as i also pointed out you can still get in!