Giter Site home page Giter Site logo

gmod-disguiser's Introduction

Disguiser SWEP

YouTube: [gmod] Derping around with the Disguiser

So you always wanted to be able to disguise as another item on the map in Sandbox or any other game mode than Prop Hunt? You were always annoyed by how you were able to see yourself being able to rotate but without knowing you were still standing all the wrong way?

That's over now with this independent weapon code. It let's you have a (somewhat) tool gun with which you can experience being a prop while not essentially playing Prop Hunt (or you can play Prop Hunt with your friends without the usual rules).

Requirements

  • A properly working Garry's Mod 13 installation

Installation

This inside the addons folder. You can compile this as a .gma file or you can put this into a subdirectory, both works. This addon will also be downloadable via the Steam Workshop, so if you're too lazy to do it now, wait for the release.

How to use?

Spawn the weapon by any means (in Sandbox via your spawn menu key, usually hold Q for that). The use your fire/primary attack key (usually left mouse key) while pointing at any thing (prop) on the map. Pop! You are now that prop, that is if you aimed properly. With the secondary attack key (usually right mouse key) you can switch back to a human being.

FAQ

When I get killed, a warning "Something is creating errors" (or similar) pops up on the top left of GMod and I get stuck outside the map. I also disappear from the player list. What is happening?

You triggered a bug of Garry's Mod. For some reason some internal code isn't properly able to handle player death events in some cases (like when you get killed while holding something) and it will bug out. As a security measurement, the server fakes a player disconnection. All you can do is reconnect and hope for the bug to not reappear for now. Note that this is not an addon-specific issue.

The addon is not loading!

Try following the installation instructions once again.

Can I change the weapon sounds?

Only do that if you're okay with changing Lua code (actual programming). You can look into the sh_init.lua and you will find SWEP.Sounds pointing at the default sound paths. Make sure you also put the sounds onto the server into the "sounds/" folder or else you will end up having no sound at all and seeing the error message "can not find sound" in the debug console instead.

Will there be a gamemode based on this weapon?

There already is the old and traditional "Prop Hunt" code which got ported to Garry's Mod 13 by xSpaceSoft, though I am going to make a re-implementation based on this weapon for bug fixes.

License

This piece of code is licensed under the GNU Affero General Public License Version 3. Why GPL? Because it's the standard license for open-source programs. Why Affero? Because Garry's Mod lets you steal the lua code (at least for the client).

gmod-disguiser's People

Contributors

icedream avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gmod-disguiser's Issues

Improve on-player-death hooking

So there is some code which disables third-person mode and does all the stuff when a player dies. Currently it is a kind of global hook which tries to check as much as possible if it is run with a player being disguised based on a variable. Currently we can't guarantee that this doesn't conflict with other addons (hey, it's always possible technically!).

Player stuck at respawn after dying

When the player dies and respawns directly afterwards in Sandbox gametype, the player gets stuck. He can only free himself by switching into another prop or using noclip.

Blood splash not visible on client-side of death victim

Inside the code is a call to the blood splash effect which should show where a prop died. That code somehow does not show visible effects on the client-side of the victim.

I guess it's another non-networked code issue inside Garry's Mod for which we need another work around user message.

Model is not being hidden properly when disguised

It seems like view and world model don't get hidden as it was intended when a player is disguised.

I already found the issue inside the code which is just simple (once again) mislead logic thinking. Going to fix it with the next commit.

Weapon effect slightly delayed on multiplayer dedicated server

The remote trigger (server -> client) for the weapon shoot effect causes a slight delay of approx. 100 ms before the actual effect triggers. This is just by nature of the user message processing architecture of Garry's Mod. It isn't that bad either, it's just noticeable.

We think about moving the shooting effect to the client-side code by allowing it to see which models are banned. (That again with a one-time usermessage or by sharing the banned props list via AddCSLuaFile? Wouldn't be that bad to share it as I would not consider it cheating to fuck up client-side effects.)

Move precaching code into SWEP:Precache hook

Currently the view and world model get precached right when sh_init.lua gets loaded. This should not be the case as there is a hook especially made for precaching stuff for the weapon.

Can use non-studio models and make server crash

Currently the weapon allows you to aim and shoot at invalid models and make the server crash. This is a severe bug.

Debug log as it is related to the crash:

Setting CBaseAnimating to non-studio model *3  (type:1)
Icedream switched to model *3
Segmentation fault

"Breaking entities" don't match colors with previously alive disguised player

When a disguised player dies, the code makes a clone entity of that player before it makes the player invisible to put a breaking and bleeding animation on it. The color of that entity is not matching the player's color setting.
Might be just that I forgot to implement it in the code as I also forgot to do that earlier with the SWEP:Disguise() function code.

Bounding box issue on first spawn

Not sure if this is caused by the Disguiser SWEP but on Sandbox there is an issue on dedicated servers that when you load/reload a map, your bounding box gets set wrongly so that you

  1. aren't able to see entities until you change into a prop.
  2. you seem to walk a few centimeters above the ground.

Gonna check this up today.

Can't shoot at entities with mismatching colors

The weapon refuses to call the shoot effects and the Disguise() function on entities, which have the same model as the player but a different color.

Not sure if this is to be seen as a bug, but if you think of it more general, two things with different color are still two different things...

Gamemode crashes on death

When a kill is triggered (both, manually via "kill" command and inside the normal gamemode workflow), the gamemode crashes due to scripting errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.