Spot Marker - 1.02 (Proaxel's Fork - 1.00)
I've added a feature that attempts to recreate the spotting functionality in more recent Coop FPSs like Payday 2 or Back 4 Blood:
When pressing WALK+USE while on any team except Infected, if your crosshair is over an entity like an item, or an infected, their outline will now glow for all other players to see, and a hint and/or chat message saying that you have marked the item will appear accordingly.
- To avoid marking entities that are invisible, or that have no point in marking (like func_brush, trigger_multiple, env_playerblocker, etc) the entity will only be marked if it has "model" in its "m_ModelName" EntProp, and has an "m_iGlowType" EntProp.
- Marked entities that are not players or infected will cause them to glow the same color as set in the "l4d_spot_marker_field_color" cvar. The normal marker will also be placed for entities that are weapons, upgrade packs, or mounted turrets. (Specifically, any entity with "weapon", "upgrade", or "minigun" in its name)
- Marked infected will always glow red, and will not have the normal marker appear at all.
- Marking Survivors will still use the behavior already implemented in the original plugin, in that it will still spawn the normal marker at the survivor's feet.
- Marks from players on the infected team do not trigger outline glows and instead will use the normal marker.
- The original behavior will be used if there is no player or entity being aimed at.
- The new messages for marking entities or players are still controlled by the "l4d_spot_marker_chat" and "l4d_spot_marker_hint" cvars.
- If an entity or player that is marked already has its outline glow EntProp already active, the plugin will check if it was responsible for turning that glow on. If it is, it will refresh the subject's glow duration. If not, the plugin will skip applying its own glow on the subject.
- Marking items and players is under a separate cooldown from the normal spot marker, determined by the new cvar "l4d_spot_marker_cooldown_playerEnts". By default, it's two seconds. Given how often it may be used, I have decided not to implement a notification saying it's ready, unless there is such demand for one.
- If WALK and USE are your only inputs being pressed, the use input will now be blocked after the marker has been added. This is to avoid picking up an item near you when you were just trying to mark it instead.
- The duration marked entities glow is determined by the cvar "l4d_spot_marker_duration".
A couple things to note:
- As you might have noticed, this is a fork of the 1.0.2 version; 1.0.3 was released after I had started work on this. However, I did include the translations that were added in version 1.0.4 and 1.0.5.
- There are two translatable phrases added so you should download this translations file for them. Right now they only have English and Spanish.
- I found a weird bug where if a weapon is marked, and then rapidly picked up and dropped multiple times, its glow will inexplicably be turned on and stay on forever. This would still occur even if it the glow was explicitly turned off through the player_use event or other means. The only fix that seems to work is explicitly turning off the glow of the entity through a post hook "weapon_drop" event. If this behavior interferes with any other plugin, you can turn it off via cvar "l4d_spot_marker_glowdropfix".
- Your crosshair has to be directly on whatever you're trying to mark, if it's slightly off or if there's anything in between, you'll use the spot marker instead. This means trying to mark through transparent surfaces like fences tends to end up marking the surface instead. I do not know if there is a feasible way to detect something through these surfaces.
- There's still stuff that can be marked probably shouldn't be allowed, like entities that are baked into the map such as doors or elevators. As far as I am aware, there doesn't seem to be any real harm in this.
- As of this post, the messages for marking players and entities are only in English and Spanish. If you're fluent in other languages, feel free to add proper translations to the translations file and upload it here as a reply to this thread.
- For English "Intro" phrase in the translations file, I have changed the phrase "Press SHIFT + E..." to "Press WALK+USE...", to account for players that may have rebound these actions to keys other than SHIFT or E. I have not done this for the other languages as I do not know what the correct terms for WALK+USE are in those languages.
- I've never owned L4D1, so I am not sure if this plugin still functions properly in that game with this additional feature. Feel free to try it and report back your findings.
- I am also a rookie to programming in SourceMod. In fact the main reason I'm releasing this is so that others can review how my code is. Please do look at it and tell me if there's anything wrong or that can be improved! Constructively of course.
Last edited by Proaxel; 05-04-2021 at 17:02.
Reason: forgot translations file