Jump to content

Welcome to the Forum!

The best place to exchange builds and ideas! Vote for the best ideas and suggestions here.

Join the Avorion Discord!

Connect with other passionate players and talk about the latest news.
Discord

DLC Avorion Into the Rift Out Now!

Now available on Steam!
Steam
  • 0

[Modding API] Missing events, and better event registry.


rater193
 Share

Suggestion

First off, there are a few events that i would like to tap into, so i can implement some specific code.

 

The main thing i want, is the ability to check when a player chats and/or types commands, then return true/false to allow, or disallow the event to continue

 

Wanted event: Detect when a player chats

example:

Event.register(Events.player.onChat, function(eventData)
local player = eventData.player
local message = eventData.message

if(message=="The phrase i dont want to be displayed in chat") then
	return false
end

if(message=="/UNWANTEDCOMMAND") then
	return false
end
--Btw, i know u can just edit the galaxies admin.xml file, but i want to implement a custom permissions engine


return true

end)

 

 

 

If it returns false, then it doesnt process the event any further

 

Wanted event: Detect when a players data saves/loads, and append custom data to it

example:

Events.register(Events.player.onDataSave, function(player, data)
data.append("Refference name", "The saved bit of data")
end)

Events.register(Events.player.onDataLoad, function(player, data)
local targetdata = data.read("Refference name")
print(targetdata)
--This would print out "The saved bit of data"
end)

 

The event engine would be a lot easier to handle if we could register to events directly, and even trigger the events.

Link to comment
Share on other sites

0 answers to this suggestion

Recommended Posts

There have been no answers to this suggestion yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...