[CSM] Add on_death, on_hp_modification & oh_damage_taken callbacks (#5093)
* Add on_death callback * Add on_hp_modification & on_damage_taken callbacks * move preview code to preview.lua
This commit is contained in:
@@ -3,20 +3,9 @@ local scriptpath = core.get_builtin_path()..DIR_DELIM
|
||||
local clientpath = scriptpath.."client"..DIR_DELIM
|
||||
|
||||
dofile(clientpath .. "register.lua")
|
||||
dofile(clientpath .. "preview.lua")
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_shutdown(function()
|
||||
print("shutdown client")
|
||||
core.register_on_death(function()
|
||||
core.display_chat_message("You died.")
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_receiving_chat_messages(function(message)
|
||||
print("Received message " .. message)
|
||||
return false
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_sending_chat_messages(function(message)
|
||||
print("Sending message " .. message)
|
||||
return false
|
||||
end)
|
||||
|
24
builtin/client/preview.lua
Normal file
24
builtin/client/preview.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_shutdown(function()
|
||||
print("shutdown client")
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_receiving_chat_messages(function(message)
|
||||
print("[PREVIEW] Received message " .. message)
|
||||
return false
|
||||
end)
|
||||
|
||||
-- This is an example function to ensure it's working properly, should be removed before merge
|
||||
core.register_on_sending_chat_messages(function(message)
|
||||
print("[PREVIEW] Sending message " .. message)
|
||||
return false
|
||||
end)
|
||||
|
||||
core.register_on_hp_modification(function(hp)
|
||||
print("[PREVIEW] HP modified " .. hp)
|
||||
end)
|
||||
|
||||
core.register_on_damage_taken(function(hp)
|
||||
print("[PREVIEW] Damage taken " .. hp)
|
||||
end)
|
@@ -58,5 +58,8 @@ end
|
||||
core.registered_on_shutdown, core.register_on_shutdown = make_registration()
|
||||
core.registered_on_receiving_chat_messages, core.register_on_receiving_chat_messages = make_registration()
|
||||
core.registered_on_sending_chat_messages, core.register_on_sending_chat_messages = make_registration()
|
||||
core.registered_on_death, core.register_on_death = make_registration()
|
||||
core.registered_on_hp_modification, core.register_on_hp_modification = make_registration()
|
||||
core.registered_on_damage_taken, core.register_on_damage_taken = make_registration()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user