fix cessation stuff

This commit is contained in:
bgkillas 2024-11-10 12:24:18 -05:00
parent 9e2820ba83
commit 9ed82cce73
9 changed files with 74 additions and 57 deletions

View file

@ -1,15 +1,10 @@
<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"
eating_area_min.y="-4"
eating_area_max.y="6"
eating_cells_per_frame="2"
></PlatformShooterPlayerComponent>
<ControlsComponent <ControlsComponent
enabled="1" enabled="1"
gamepad_fire_on_thumbstick_extend="0" gamepad_fire_on_thumbstick_extend="0"

View file

@ -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")
@ -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", {

View file

@ -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

View file

@ -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")

View file

@ -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()

View file

@ -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 )

View 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)

View file

@ -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

View file

@ -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()