Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ENTITY:DeterminePhysgunHalo() for all entities #2151

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Zaurzo
Copy link
Contributor

@Zaurzo Zaurzo commented Nov 11, 2024

This will allow entities to modify how the physgun halo is drawn on them. This function has three returns: the entity or entities to draw the halo on, the color of the halo, and the size.

function ENT:DeterminePhysgunHalo(ply, color, size, weapon, boneid, pos)
    return self, color, size
end

The first return value can either be an entity, or a table of entities. I want to allow a table of entities, so that, for example, you can draw the halo on any entities that are parented to the physgunned entity. If it's nil, or it's not an entity or table of entities, it will suppress the halo.

The second and third return value is the halo color and size. These are optional, and it will fallback to the default color and size if omitted.

Example

Before:
example_1

Code:

function ENT:DeterminePhysgunHalo()
    local entsToHalo = self.haloTab

    if not entsToHalo then
        entsToHalo = { self }
        self.haloTab = entsToHalo
    end

    local light = self.light

    if not IsValid(light) then
        self.light = self:GetChildren()[1]

        return self
    end

    entsToHalo[2] = light

    return entsToHalo
end

After:
example_2

Example 2

Rainbow physgun halo:

function ENT:DeterminePhysgunHalo()

    return self, HSVToColor( ( CurTime() * 100 ) % 360, 1, 1 )

end

This allows entities to determine how the physgun halo is drawn on them. It can also be used to add the halo to other entities, e.g. the other entities that are parented to it
Just return `self`
@Zaurzo Zaurzo changed the title Add ENT:DrawPhysgunHalo() for all entities Add ENT:DeterminePhysgunHalo() for all entities Nov 12, 2024
@Zaurzo Zaurzo changed the title Add ENT:DeterminePhysgunHalo() for all entities Add ENTITY:DeterminePhysgunHalo() for all entities Nov 12, 2024
@robotboy655 robotboy655 added the Addition The pull request adds new functionality. label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Addition The pull request adds new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants