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" >
|
||||
<PlatformShooterPlayerComponent
|
||||
center_camera_on_this_entity="1"
|
||||
aiming_reticle_distance_from_character="60"
|
||||
camera_max_distance_from_character="50"
|
||||
move_camera_with_aim="1"
|
||||
eating_area_min.x="-6"
|
||||
eating_area_max.x="6"
|
||||
eating_area_min.y="-4"
|
||||
eating_area_max.y="6"
|
||||
eating_cells_per_frame="2"
|
||||
></PlatformShooterPlayerComponent>
|
||||
<ControlsComponent
|
||||
enabled="1"
|
||||
gamepad_fire_on_thumbstick_extend="0"
|
||||
gamepad_fire_on_thumbstick_extend_threshold="0.9"
|
||||
gamepad_indirect_aiming_enabled="0"
|
||||
></ControlsComponent>
|
||||
<Entity name="cursor">
|
||||
<SpriteComponent
|
||||
alpha="1"
|
||||
image_file="mods/quant.ew/files/resource/sprites/cursor.png"
|
||||
next_rect_animation=""
|
||||
offset_x="6.5"
|
||||
offset_y="6.5"
|
||||
emissive="1"
|
||||
additive="1"
|
||||
rect_animation=""
|
||||
z_index="1"
|
||||
update_transform="1"
|
||||
update_transform_rotation="0"
|
||||
has_special_scale="1"
|
||||
special_scale_x="0.5"
|
||||
special_scale_y="0.5"
|
||||
></SpriteComponent>
|
||||
</Entity>
|
||||
<Entity tags="polymorphed_cessation" name="$animal_player" >
|
||||
<LuaComponent
|
||||
script_source_file="mods/quant.ew/files/system/local_health/notplayer/cessation.lua"
|
||||
execute_every_n_frame="-1"
|
||||
execute_on_removed="1"
|
||||
>
|
||||
</LuaComponent>
|
||||
<ControlsComponent
|
||||
enabled="1"
|
||||
gamepad_fire_on_thumbstick_extend="0"
|
||||
gamepad_fire_on_thumbstick_extend_threshold="0.9"
|
||||
gamepad_indirect_aiming_enabled="0"
|
||||
></ControlsComponent>
|
||||
<Entity name="cursor">
|
||||
<SpriteComponent
|
||||
alpha="1"
|
||||
image_file="mods/quant.ew/files/resource/sprites/cursor.png"
|
||||
next_rect_animation=""
|
||||
offset_x="6.5"
|
||||
offset_y="6.5"
|
||||
emissive="1"
|
||||
additive="1"
|
||||
rect_animation=""
|
||||
z_index="1"
|
||||
update_transform="1"
|
||||
update_transform_rotation="0"
|
||||
has_special_scale="1"
|
||||
special_scale_x="0.5"
|
||||
special_scale_y="0.5"
|
||||
></SpriteComponent>
|
||||
</Entity>
|
||||
</Entity>
|
|
@ -232,11 +232,6 @@ local function player_died()
|
|||
GameAddFlagRun("msg_gods_looking")
|
||||
GameAddFlagRun("msg_gods_looking2")
|
||||
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
|
||||
end
|
||||
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", "")
|
||||
print("extra_death_msg removed")
|
||||
end
|
||||
|
||||
|
||||
local damage_model = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "DamageModelComponent")
|
||||
if damage_model ~= nil then
|
||||
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", false)
|
||||
|
@ -303,7 +298,9 @@ 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)
|
||||
if damage_model ~= nil then
|
||||
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", true)
|
||||
end
|
||||
ctx.my_player.status = { is_alive = true }
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
end
|
||||
local prev_nickname = EntityGetFirstComponentIncludingDisabled(player_entity, "SpriteComponent", "ew_nickname")
|
||||
|
|
|
@ -580,7 +580,8 @@ end
|
|||
|
||||
local function is_suitable_target(entity)
|
||||
return EntityGetIsAlive(entity)
|
||||
and not EntityHasTag(entity,"ew_notplayer")
|
||||
and not EntityHasTag(entity, "ew_notplayer")
|
||||
and EntityHasTag(entity, "mortal")
|
||||
end
|
||||
|
||||
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_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 )
|
||||
|
||||
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"
|
||||
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
|
||||
local ent = player.entity
|
||||
local children = EntityGetAllChildren(ent) or {}
|
||||
for _, child in ipairs(children) do
|
||||
if EntityGetName(child) == "cursor" or EntityGetName(child) == "notcursor" then
|
||||
EntitySetComponentIsEnabled(child, EntityGetFirstComponentIncludingDisabled(child, "SpriteComponent"), true)
|
||||
if ctx.my_id ~= peer_id then
|
||||
for _, child in ipairs(children) do
|
||||
if EntityGetName(child) == "cursor" or EntityGetName(child) == "notcursor" then
|
||||
EntitySetComponentIsEnabled(child, EntityGetFirstComponentIncludingDisabled(child, "SpriteComponent"), true)
|
||||
end
|
||||
end
|
||||
end
|
||||
local x, y = EntityGetTransform(ent)
|
||||
|
|
|
@ -24,6 +24,13 @@ local attached = 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)
|
||||
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
|
||||
if EntityHasTag(child, "perk_entity") then
|
||||
|
@ -72,7 +79,7 @@ local function get_me()
|
|||
local i = 0
|
||||
local alive = -1, -1
|
||||
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
|
||||
end
|
||||
i = i + 1
|
||||
|
@ -87,6 +94,9 @@ end
|
|||
|
||||
local function set_camera_free(enable)
|
||||
local cam = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PlatformShooterPlayerComponent")
|
||||
if EntityHasTag(ctx.my_player.entity, "polymorphed_cessation") then
|
||||
return
|
||||
end
|
||||
if cam ~= nil then
|
||||
ComponentSetValue2(cam, "center_camera_on_this_entity", not enable)
|
||||
ComponentSetValue2(cam, "move_camera_with_aim", not enable)
|
||||
|
@ -95,6 +105,9 @@ end
|
|||
|
||||
local function set_camera_position(x, y)
|
||||
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
|
||||
ComponentSetValue2(cam, "mDesiredCameraPos", x, y)
|
||||
end
|
||||
|
@ -218,7 +231,7 @@ local function set_camera_pos()
|
|||
if cam_target == nil or re_cam then
|
||||
local i = 0
|
||||
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
|
||||
end
|
||||
i = i + 1
|
||||
|
@ -246,8 +259,7 @@ end
|
|||
local function update_i()
|
||||
local i = 0
|
||||
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
|
||||
end
|
||||
i = i + 1
|
||||
|
@ -264,7 +276,7 @@ end
|
|||
local function number_of_players()
|
||||
local i = 0
|
||||
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
|
||||
end
|
||||
i = i + 1
|
||||
|
@ -298,8 +310,7 @@ function spectate.on_world_update()
|
|||
last_len = number_of_players()
|
||||
end
|
||||
if cam_target ~= nil
|
||||
and ((GameHasFlagRun("ending_game_completed") or ctx.proxy_opt.perma_death)
|
||||
and EntityHasTag(cam_target.entity, "ew_notplayer")) then
|
||||
and cant_spectate(cam_target.entity) then
|
||||
update_i()
|
||||
last_len = number_of_players()
|
||||
end
|
||||
|
|
|
@ -238,7 +238,9 @@ function OnPlayerSpawned( player_entity ) -- This runs when player entity has be
|
|||
net.send_welcome()
|
||||
|
||||
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_should_send_updates()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue