mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
fix cessation stuff
This commit is contained in:
parent
9e2820ba83
commit
9ed82cce73
9 changed files with 74 additions and 57 deletions
|
@ -1,37 +1,32 @@
|
||||||
<Entity tags="polymorphed_cessation" name="$animal_player" >
|
<Entity tags="polymorphed_cessation" name="$animal_player" >
|
||||||
<PlatformShooterPlayerComponent
|
<LuaComponent
|
||||||
center_camera_on_this_entity="1"
|
script_source_file="mods/quant.ew/files/system/local_health/notplayer/cessation.lua"
|
||||||
aiming_reticle_distance_from_character="60"
|
execute_every_n_frame="-1"
|
||||||
camera_max_distance_from_character="50"
|
execute_on_removed="1"
|
||||||
move_camera_with_aim="1"
|
>
|
||||||
eating_area_min.x="-6"
|
</LuaComponent>
|
||||||
eating_area_max.x="6"
|
<ControlsComponent
|
||||||
eating_area_min.y="-4"
|
enabled="1"
|
||||||
eating_area_max.y="6"
|
gamepad_fire_on_thumbstick_extend="0"
|
||||||
eating_cells_per_frame="2"
|
gamepad_fire_on_thumbstick_extend_threshold="0.9"
|
||||||
></PlatformShooterPlayerComponent>
|
gamepad_indirect_aiming_enabled="0"
|
||||||
<ControlsComponent
|
></ControlsComponent>
|
||||||
enabled="1"
|
<Entity name="cursor">
|
||||||
gamepad_fire_on_thumbstick_extend="0"
|
<SpriteComponent
|
||||||
gamepad_fire_on_thumbstick_extend_threshold="0.9"
|
alpha="1"
|
||||||
gamepad_indirect_aiming_enabled="0"
|
image_file="mods/quant.ew/files/resource/sprites/cursor.png"
|
||||||
></ControlsComponent>
|
next_rect_animation=""
|
||||||
<Entity name="cursor">
|
offset_x="6.5"
|
||||||
<SpriteComponent
|
offset_y="6.5"
|
||||||
alpha="1"
|
emissive="1"
|
||||||
image_file="mods/quant.ew/files/resource/sprites/cursor.png"
|
additive="1"
|
||||||
next_rect_animation=""
|
rect_animation=""
|
||||||
offset_x="6.5"
|
z_index="1"
|
||||||
offset_y="6.5"
|
update_transform="1"
|
||||||
emissive="1"
|
update_transform_rotation="0"
|
||||||
additive="1"
|
has_special_scale="1"
|
||||||
rect_animation=""
|
special_scale_x="0.5"
|
||||||
z_index="1"
|
special_scale_y="0.5"
|
||||||
update_transform="1"
|
></SpriteComponent>
|
||||||
update_transform_rotation="0"
|
</Entity>
|
||||||
has_special_scale="1"
|
|
||||||
special_scale_x="0.5"
|
|
||||||
special_scale_y="0.5"
|
|
||||||
></SpriteComponent>
|
|
||||||
</Entity>
|
|
||||||
</Entity>
|
</Entity>
|
|
@ -232,11 +232,6 @@ local function player_died()
|
||||||
GameAddFlagRun("msg_gods_looking")
|
GameAddFlagRun("msg_gods_looking")
|
||||||
GameAddFlagRun("msg_gods_looking2")
|
GameAddFlagRun("msg_gods_looking2")
|
||||||
EntityAddTag(ctx.my_player.entity, "ew_notplayer")
|
EntityAddTag(ctx.my_player.entity, "ew_notplayer")
|
||||||
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
|
|
||||||
if EntityGetName(child) == "cursor" then
|
|
||||||
EntitySetComponentIsEnabled(child, EntityGetFirstComponentIncludingDisabled(child, "SpriteComponent"), false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local ent = LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/local_health/notplayer/poly_effect.xml")
|
local ent = LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/local_health/notplayer/poly_effect.xml")
|
||||||
|
@ -286,7 +281,7 @@ local function do_game_over(message)
|
||||||
ComponentSetValue2(stat_component, "extra_death_msg", "")
|
ComponentSetValue2(stat_component, "extra_death_msg", "")
|
||||||
print("extra_death_msg removed")
|
print("extra_death_msg removed")
|
||||||
end
|
end
|
||||||
|
|
||||||
local damage_model = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "DamageModelComponent")
|
local damage_model = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "DamageModelComponent")
|
||||||
if damage_model ~= nil then
|
if damage_model ~= nil then
|
||||||
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", false)
|
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", false)
|
||||||
|
@ -303,7 +298,9 @@ end
|
||||||
|
|
||||||
function module.on_local_player_spawn(my_player)
|
function module.on_local_player_spawn(my_player)
|
||||||
local damage_model = EntityGetFirstComponentIncludingDisabled(my_player.entity, "DamageModelComponent")
|
local damage_model = EntityGetFirstComponentIncludingDisabled(my_player.entity, "DamageModelComponent")
|
||||||
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", true)
|
if damage_model ~= nil then
|
||||||
|
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", true)
|
||||||
|
end
|
||||||
ctx.my_player.status = { is_alive = true }
|
ctx.my_player.status = { is_alive = true }
|
||||||
|
|
||||||
util.ensure_component_present(my_player.entity, "LuaComponent", "ew_player_damage", {
|
util.ensure_component_present(my_player.entity, "LuaComponent", "ew_player_damage", {
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
local ent = GetUpdatedEntityID()
|
||||||
|
for _, child in ipairs(EntityGetAllChildren(ent) or {}) do
|
||||||
|
if EntityGetName(child) == "cursor" then
|
||||||
|
EntitySetComponentIsEnabled(child, EntityGetFirstComponentIncludingDisabled(child, "SpriteComponent"), false)
|
||||||
|
end
|
||||||
|
end
|
|
@ -73,7 +73,7 @@ function nickname.calculate_textwidth(text, font)
|
||||||
end
|
end
|
||||||
|
|
||||||
function nickname.add_label(player_entity, text, font_filename, scale, alpha)
|
function nickname.add_label(player_entity, text, font_filename, scale, alpha)
|
||||||
if not EntityGetIsAlive(player_entity) then
|
if not EntityGetIsAlive(player_entity) or EntityHasTag(player_entity, "polymorphed_cessation") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local prev_nickname = EntityGetFirstComponentIncludingDisabled(player_entity, "SpriteComponent", "ew_nickname")
|
local prev_nickname = EntityGetFirstComponentIncludingDisabled(player_entity, "SpriteComponent", "ew_nickname")
|
||||||
|
|
|
@ -580,7 +580,8 @@ end
|
||||||
|
|
||||||
local function is_suitable_target(entity)
|
local function is_suitable_target(entity)
|
||||||
return EntityGetIsAlive(entity)
|
return EntityGetIsAlive(entity)
|
||||||
and not EntityHasTag(entity,"ew_notplayer")
|
and not EntityHasTag(entity, "ew_notplayer")
|
||||||
|
and EntityHasTag(entity, "mortal")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function choose_wand_actions()
|
local function choose_wand_actions()
|
||||||
|
|
|
@ -21,9 +21,12 @@ function player_color(player_entity)
|
||||||
|
|
||||||
local player_sprite_component = EntityGetFirstComponent( player_entity, "SpriteComponent" )
|
local player_sprite_component = EntityGetFirstComponent( player_entity, "SpriteComponent" )
|
||||||
local player_sprite_file = "mods/quant.ew/files/system/player/tmp/" .. ctx.my_id .. ".xml"
|
local player_sprite_file = "mods/quant.ew/files/system/player/tmp/" .. ctx.my_id .. ".xml"
|
||||||
|
local player_arm_sprite_component = EntityGetFirstComponent( player_arm, "SpriteComponent" )
|
||||||
|
if player_sprite_component == nil or player_arm_sprite_component == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
ComponentSetValue( player_sprite_component, "image_file", player_sprite_file )
|
ComponentSetValue( player_sprite_component, "image_file", player_sprite_file )
|
||||||
|
|
||||||
local player_arm_sprite_component = EntityGetFirstComponent( player_arm, "SpriteComponent" )
|
|
||||||
local player_arm_sprite_file = "mods/quant.ew/files/system/player/tmp/" .. ctx.my_id .. "_arm.xml"
|
local player_arm_sprite_file = "mods/quant.ew/files/system/player/tmp/" .. ctx.my_id .. "_arm.xml"
|
||||||
ComponentSetValue( player_arm_sprite_component, "image_file", player_arm_sprite_file )
|
ComponentSetValue( player_arm_sprite_component, "image_file", player_arm_sprite_file )
|
||||||
|
|
||||||
|
|
|
@ -75,9 +75,11 @@ function module.on_world_update()
|
||||||
for peer_id, player in pairs(ctx.players) do
|
for peer_id, player in pairs(ctx.players) do
|
||||||
local ent = player.entity
|
local ent = player.entity
|
||||||
local children = EntityGetAllChildren(ent) or {}
|
local children = EntityGetAllChildren(ent) or {}
|
||||||
for _, child in ipairs(children) do
|
if ctx.my_id ~= peer_id then
|
||||||
if EntityGetName(child) == "cursor" or EntityGetName(child) == "notcursor" then
|
for _, child in ipairs(children) do
|
||||||
EntitySetComponentIsEnabled(child, EntityGetFirstComponentIncludingDisabled(child, "SpriteComponent"), true)
|
if EntityGetName(child) == "cursor" or EntityGetName(child) == "notcursor" then
|
||||||
|
EntitySetComponentIsEnabled(child, EntityGetFirstComponentIncludingDisabled(child, "SpriteComponent"), true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local x, y = EntityGetTransform(ent)
|
local x, y = EntityGetTransform(ent)
|
||||||
|
|
|
@ -24,6 +24,13 @@ local attached = false
|
||||||
|
|
||||||
local redo = false
|
local redo = false
|
||||||
|
|
||||||
|
local function cant_spectate(ent)
|
||||||
|
return ((GameHasFlagRun("ending_game_completed") or ctx.proxy_opt.perma_death)
|
||||||
|
and EntityHasTag(potential_target.entity, "ew_notplayer"))
|
||||||
|
or (EntityHasTag(ent, "polymorphed_cessation")
|
||||||
|
and cam_target ~= nil and cam_target.entity ~= ent)
|
||||||
|
end
|
||||||
|
|
||||||
local function perks_ui(enable)
|
local function perks_ui(enable)
|
||||||
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
|
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
|
||||||
if EntityHasTag(child, "perk_entity") then
|
if EntityHasTag(child, "perk_entity") then
|
||||||
|
@ -72,7 +79,7 @@ local function get_me()
|
||||||
local i = 0
|
local i = 0
|
||||||
local alive = -1, -1
|
local alive = -1, -1
|
||||||
for peer_id, potential_target in pairs(ctx.players) do
|
for peer_id, potential_target in pairs(ctx.players) do
|
||||||
if (GameHasFlagRun("ending_game_completed") or ctx.proxy_opt.perma_death) and EntityHasTag(potential_target.entity, "ew_notplayer") then
|
if cant_spectate(potential_target.entity) then
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
@ -87,6 +94,9 @@ end
|
||||||
|
|
||||||
local function set_camera_free(enable)
|
local function set_camera_free(enable)
|
||||||
local cam = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PlatformShooterPlayerComponent")
|
local cam = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PlatformShooterPlayerComponent")
|
||||||
|
if EntityHasTag(ctx.my_player.entity, "polymorphed_cessation") then
|
||||||
|
return
|
||||||
|
end
|
||||||
if cam ~= nil then
|
if cam ~= nil then
|
||||||
ComponentSetValue2(cam, "center_camera_on_this_entity", not enable)
|
ComponentSetValue2(cam, "center_camera_on_this_entity", not enable)
|
||||||
ComponentSetValue2(cam, "move_camera_with_aim", not enable)
|
ComponentSetValue2(cam, "move_camera_with_aim", not enable)
|
||||||
|
@ -95,6 +105,9 @@ end
|
||||||
|
|
||||||
local function set_camera_position(x, y)
|
local function set_camera_position(x, y)
|
||||||
local cam = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PlatformShooterPlayerComponent")
|
local cam = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PlatformShooterPlayerComponent")
|
||||||
|
if cam == nil then
|
||||||
|
cam = EntityAddComponent2(ctx.my_player.entity, "PlatformShooterPlayerComponent", {center_camera_on_this_entity=false, move_camera_with_aim=false})
|
||||||
|
end
|
||||||
if cam ~= nil then
|
if cam ~= nil then
|
||||||
ComponentSetValue2(cam, "mDesiredCameraPos", x, y)
|
ComponentSetValue2(cam, "mDesiredCameraPos", x, y)
|
||||||
end
|
end
|
||||||
|
@ -218,7 +231,7 @@ local function set_camera_pos()
|
||||||
if cam_target == nil or re_cam then
|
if cam_target == nil or re_cam then
|
||||||
local i = 0
|
local i = 0
|
||||||
for peer_id, potential_target in pairs(ctx.players) do
|
for peer_id, potential_target in pairs(ctx.players) do
|
||||||
if (GameHasFlagRun("ending_game_completed") or ctx.proxy_opt.perma_death) and EntityHasTag(potential_target.entity, "ew_notplayer") then
|
if cant_spectate(potential_target.entity) then
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
@ -246,8 +259,7 @@ end
|
||||||
local function update_i()
|
local function update_i()
|
||||||
local i = 0
|
local i = 0
|
||||||
for peer_id, potential_target in pairs(ctx.players) do
|
for peer_id, potential_target in pairs(ctx.players) do
|
||||||
if (GameHasFlagRun("ending_game_completed") or ctx.proxy_opt.perma_death)
|
if cant_spectate(potential_target.entity) then
|
||||||
and EntityHasTag(potential_target.entity, "ew_notplayer") then
|
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
@ -264,7 +276,7 @@ end
|
||||||
local function number_of_players()
|
local function number_of_players()
|
||||||
local i = 0
|
local i = 0
|
||||||
for _, potential_target in pairs(ctx.players) do
|
for _, potential_target in pairs(ctx.players) do
|
||||||
if (GameHasFlagRun("ending_game_completed") or ctx.proxy_opt.perma_death) and EntityHasTag(potential_target.entity, "ew_notplayer") then
|
if cant_spectate(potential_target.entity) then
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
@ -298,8 +310,7 @@ function spectate.on_world_update()
|
||||||
last_len = number_of_players()
|
last_len = number_of_players()
|
||||||
end
|
end
|
||||||
if cam_target ~= nil
|
if cam_target ~= nil
|
||||||
and ((GameHasFlagRun("ending_game_completed") or ctx.proxy_opt.perma_death)
|
and cant_spectate(cam_target.entity) then
|
||||||
and EntityHasTag(cam_target.entity, "ew_notplayer")) then
|
|
||||||
update_i()
|
update_i()
|
||||||
last_len = number_of_players()
|
last_len = number_of_players()
|
||||||
end
|
end
|
||||||
|
|
|
@ -238,7 +238,9 @@ function OnPlayerSpawned( player_entity ) -- This runs when player entity has be
|
||||||
net.send_welcome()
|
net.send_welcome()
|
||||||
|
|
||||||
local item_pick = EntityGetFirstComponentIncludingDisabled(player_entity, "ItemPickUpperComponent")
|
local item_pick = EntityGetFirstComponentIncludingDisabled(player_entity, "ItemPickUpperComponent")
|
||||||
ComponentSetValue2(item_pick, "is_immune_to_kicks", true)
|
if item_pick ~= nil then
|
||||||
|
ComponentSetValue2(item_pick, "is_immune_to_kicks", true)
|
||||||
|
end
|
||||||
|
|
||||||
ctx.hook.on_local_player_spawn(my_player)
|
ctx.hook.on_local_player_spawn(my_player)
|
||||||
ctx.hook.on_should_send_updates()
|
ctx.hook.on_should_send_updates()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue