This commit is contained in:
2023-08-19 19:21:17 +08:00
parent 36dfa79e0d
commit 76b7abf06b
111 changed files with 12062 additions and 867 deletions

Binary file not shown.

View File

@@ -0,0 +1,3 @@
<Atlas><Texture filename="modicon.tex" />
<Elements><Element name="modicon.tex" u1="0" u2="1" v1="0" v2="1" />
</Elements></Atlas>

View File

@@ -0,0 +1,64 @@
name = 'Your skeleton respawn'
description = "Resurrection from your skeleton! Allows you to resurrect yourself on your skeleton. ----------UPDATED---------- + Added the ability to configure health penalty --------------------------------"
author = 'BEKKITT'
version = '1.2.6.2'
dont_starve_compatible = true
dst_compatible = true
reign_of_giants_compatible = true
client_only_mod = false
all_clients_require_mod = false
forumthread = ''
api_version = 10
server_filter_tags = {'bekkitt', 'resurrection', 'skeleton',}
icon_atlas = 'modicon.xml'
icon = 'modicon.tex'
configuration_options =
{
{
name = 'skeleton_player',
label = '',
default = true,
options = {
{description = '', data = true},
},
},
{
name = 'bekkitt_skeleton_pen',
label = 'Blood sacrifice',
default = 0,
options = {
{description = '0%',data = 0, hover = "No health pentalty"},
{description = '5%', data = 0.05, hover = "5% health pentalty"},
{description = '10%', data = 0.1, hover = "10% health pentalty"},
{description = '25%', data = 0.25, hover = "Default in DST 25% health pentalty"},
{description = '30%', data = 0.3, hover = "30% health pentalty"},
{description = '40%', data = 0.4, hover = "40% health pentalty"},
{description = '50%', data = 0.5, hover = "50% health pentalty"},
{description = '60%', data = 0.6, hover = "60% health pentalty"},
{description = '70%', data = 0.7, hover = "70% health pentalty"},
{description = '75%', data = 0.75, hover = "75% Max in DST health pentalty"},
},
},
{
name = 'null_option',
label = '',
default = true,
options = {
{description = '', data = true},
},
},
}

View File

@@ -0,0 +1,89 @@
local bekkitt_prefabs = {
'skeleton_player',
}
function apply_negative_effects(inst)
if inst.LastResSource and inst.LastResSource:HasTag('bekkitt_skeleton_resp') then
new_penalty = inst.components.health.penalty + GetModConfigData('bekkitt_skeleton_pen')
if new_penalty >= .75 then
new_penalty = .75
end
inst.components.health.penalty = new_penalty
inst.components.health:ForceUpdateHUD(false)
end
end
function save_last_respawn_source(inst, data)
if data then
inst.LastResSource = data.source
end
end
AddPlayerPostInit(
function(inst)
inst:ListenForEvent('respawnfromghost', save_last_respawn_source)
inst:ListenForEvent('ms_respawnedfromghost', apply_negative_effects)
end
)
local light_fire_on_haunt = function(inst, haunter)
if ( inst.components.fueled ~= nil ) then
inst.components.fueled:DoDelta( TUNING.LARGE_FUEL )
end
return true
end
for i, prefab_name in ipairs( bekkitt_prefabs ) do
local allow_rez = GetModConfigData( prefab_name )
if ( allow_rez ) then
AddPrefabPostInit(
prefab_name,
function(inst)
if ( inst.components.hauntable ~= nil ) then
inst:RemoveComponent('hauntable')
end
inst:AddComponent('hauntable')
inst.components.hauntable:SetOnHauntFn( light_fire_on_haunt )
inst.components.hauntable:SetHauntValue(TUNING.HAUNT_INSTANT_REZ)
inst:AddTag('resurrector')
inst:AddTag('bekkitt_skeleton_resp')
end
)
end
end
local function SkeletonRemove(inst)
for k,ent in pairs(GLOBAL.Ents) do
if ent.prefab == "skeleton_player" and ent.playername == inst.name then
ent:Remove()
end
end
end
local function SkeletonRemoval(inst)
inst:ListenForEvent("death", SkeletonRemove)
end
AddPlayerPostInit(SkeletonRemoval)