Remove default death handling.

This commit is contained in:
IQuant 2024-08-07 16:37:54 +03:00
parent 5867d76c47
commit 642a487fd7
4 changed files with 31 additions and 8 deletions

View file

@ -0,0 +1,3 @@
function OnPlayerDied( player_entity )
print("Default death handling prevented")
end

View file

@ -9,14 +9,14 @@ local np = require("noitapatcher")
local rpc = net.new_rpc_namespace()
local module = {}
module.recent_damage = 0
module.recent_message = "unknown"
module.last_damage_message = "unknown"
ModLuaFileAppend("data/scripts/game_helpers.lua", "mods/quant.ew/files/src/system/damage/append/game_helpers.lua")
ModTextFileSetContent("data/entities/misc/effect_hearty.xml", ModTextFileGetContent("mods/quant.ew/files/src/system/damage/append/hearty_effect.xml"))
function module.on_player_died(player_entity)
GamePrint("d "..player_entity)
ctx.run_ended = true
end
local function do_game_over(message)
net.proxy_notify_game_over()
@ -31,7 +31,7 @@ end
function module.on_local_player_spawn(my_player)
local damage_model = EntityGetFirstComponentIncludingDisabled(my_player.entity, "DamageModelComponent")
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", true)
-- ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", true)
end
function module.on_world_update_client()

View file

@ -318,6 +318,8 @@ function OnModPreInit()
net.init()
load_modules()
print("Entangled worlds init ok")
end
function OnModInit() end
@ -325,4 +327,7 @@ function OnModInit() end
function OnModPostInit() end
print("entangled_worlds init ok")
function OnPlayerDied(player_entity)
ctx.hook.on_player_died(player_entity)
print("player died")
end

View file

@ -1,3 +1,14 @@
local function early_init()
if #ModLuaFileGetAppends("mods/quant.ew/files/src/early_init.lua") == 0 then
-- Use appends to store data
ModLuaFileAppend("mods/quant.ew/files/src/early_init.lua", "data/scripts/empty.lua")
-- Early init stuff, called before main "mod" is loaded. Meaning we can append to data/scripts/init.lua
end
ModLuaFileAppend("data/scripts/init.lua", "mods/quant.ew/files/append/no_default_death_handling.lua")
end
dofile("data/scripts/lib/mod_settings.lua") -- see this file for documentation on some of the features.
-- This file can't access other files from this or other mods in all circumstances.
@ -31,6 +42,10 @@ mod_settings =
function ModSettingsUpdate( init_scope )
local old_version = mod_settings_get_version( mod_id ) -- This can be used to migrate some settings between mod versions.
mod_settings_update( mod_id, mod_settings, init_scope )
if ModIsEnabled(mod_id) then
print("Running early init fn")
early_init()
end
end
-- This function should return the number of visible setting UI elements.