diff --git a/quant.ew/data/entities/animals/nibbana.xml b/quant.ew/data/entities/animals/nibbana.xml index e7bbefa6..d90cf410 100644 --- a/quant.ew/data/entities/animals/nibbana.xml +++ b/quant.ew/data/entities/animals/nibbana.xml @@ -1,37 +1,32 @@ - - - - - - + + + + + + + \ No newline at end of file diff --git a/quant.ew/files/system/local_health/local_health.lua b/quant.ew/files/system/local_health/local_health.lua index 0fb7b679..fb233ec8 100644 --- a/quant.ew/files/system/local_health/local_health.lua +++ b/quant.ew/files/system/local_health/local_health.lua @@ -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", { diff --git a/quant.ew/files/system/local_health/notplayer/cessation.lua b/quant.ew/files/system/local_health/notplayer/cessation.lua new file mode 100644 index 00000000..3ad250f5 --- /dev/null +++ b/quant.ew/files/system/local_health/notplayer/cessation.lua @@ -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 \ No newline at end of file diff --git a/quant.ew/files/system/nickname.lua b/quant.ew/files/system/nickname.lua index e760c3f1..20fee27e 100644 --- a/quant.ew/files/system/nickname.lua +++ b/quant.ew/files/system/nickname.lua @@ -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") diff --git a/quant.ew/files/system/notplayer_ai/notplayer_ai.lua b/quant.ew/files/system/notplayer_ai/notplayer_ai.lua index 563a90b8..ec06be4b 100644 --- a/quant.ew/files/system/notplayer_ai/notplayer_ai.lua +++ b/quant.ew/files/system/notplayer_ai/notplayer_ai.lua @@ -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() diff --git a/quant.ew/files/system/player/player_cosmetics.lua b/quant.ew/files/system/player/player_cosmetics.lua index 56a59fe1..57444e20 100644 --- a/quant.ew/files/system/player/player_cosmetics.lua +++ b/quant.ew/files/system/player/player_cosmetics.lua @@ -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 ) diff --git a/quant.ew/files/system/player_sync.lua b/quant.ew/files/system/player_sync.lua index 1133c7a8..d67c2530 100644 --- a/quant.ew/files/system/player_sync.lua +++ b/quant.ew/files/system/player_sync.lua @@ -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) diff --git a/quant.ew/files/system/spectate/spectate.lua b/quant.ew/files/system/spectate/spectate.lua index 768e6845..0320c531 100644 --- a/quant.ew/files/system/spectate/spectate.lua +++ b/quant.ew/files/system/spectate/spectate.lua @@ -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 diff --git a/quant.ew/init.lua b/quant.ew/init.lua index 67a6ebfd..b2e2750a 100755 --- a/quant.ew/init.lua +++ b/quant.ew/init.lua @@ -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()