Skip to content

[Feature Request] Add hook to load custom entities classnames in sv_specialfcn.lua #40

@Injector

Description

@Injector

The titile says all. Currently I doing like this one, sometimes it works, sometimes doesn't, because of priority load order I guess. So SpecialENTSSave and SpecialENTSSpawn for custom entities being loaded AFTER PermaProps placed all props from the db, not BEFORE.

Yes, I know that I can change sv_specialfcn.lua, but what if user uses PermaProps in gmod workshop instead of my customized PermaProps?

My code:

if (file.Find("permaprops/sv_specialfcn.lua", "LUA")) then
	include("permaprops/sv_specialfcn.lua")
end

if (PermaProps) then
	PermaProps.SpecialENTSSave["pw_paper"] = function(ent)
		
		local content = {}
		content.Other = {}
		content.Other["text"] = ent.data
		content.Other["name"] = ent.name
		
		return content
	end
	
	PermaProps.SpecialENTSSpawn["pw_paper"] = function(ent, data)
		ent:Spawn()
		
		ent.data = data["text"]
		ent.name = data["name"]
		
		return true
	end
	
	print("Successfully loaded PaperWork compatibility with PermaProps")
end

So it would be nice to see something like hook.Add("PermaProps.InitializeCustomEntityClassname", function() /* your code here */ end) and:

/* some code */
hook.Run("PermaProps.InitializeCustomEntityClassname", ...)
/* run code to place perma props */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions