Reduce more animations for a cleaner image

- Add override misc\custom_cards\energy_shield.xml
- Add override misc\custom_cards\action.xml
- Add override entities\base_custom_card.xml
- Add override to data/scripts/perks/perk.lua that disables SpriteOffsetAnimatorComponent
- Add WrapID functions to Noita API
- Remove unecessary entity modifications in capture.lua
This commit is contained in:
David Vogel 2022-07-18 22:53:34 +02:00
parent f58b005155
commit 8f3ecefa8b
7 changed files with 351 additions and 8 deletions

View File

@ -0,0 +1,70 @@
<Entity name="card" tags="card_action">
<ItemComponent
_tags="enabled_in_world"
play_spinning_animation="0"
preferred_inventory="FULL"
></ItemComponent>
<HitboxComponent
_tags="enabled_in_world"
aabb_min_x="-4"
aabb_max_x="4"
aabb_min_y="-3"
aabb_max_y="3"
></HitboxComponent>
<SimplePhysicsComponent
_tags="enabled_in_world"
></SimplePhysicsComponent>
<VelocityComponent
_tags="enabled_in_world"
></VelocityComponent>
<!-- <SpriteComponent
_tags="enabled_in_world,item_unlocked"
image_file="data/ui_gfx/gun_actions/empty.png"
offset_x="8"
offset_y="8"
></SpriteComponent>
<SpriteComponent
_tags="enabled_in_world,item_locked"
image_file="data/ui_gfx/gun_actions/unidentified.png"
offset_x="8"
offset_y="8"
></SpriteComponent> -->
<SpriteComponent
_tags="enabled_in_world,item_identified"
image_file="data/ui_gfx/gun_actions/empty.png"
offset_x="8"
offset_y="17"
z_index="-1.51"
></SpriteComponent>
<SpriteComponent
_enabled="0"
_tags="enabled_in_world,item_unidentified"
image_file="data/ui_gfx/gun_actions/unidentified.png"
offset_x="8"
offset_y="17"
z_index="-1.51"
></SpriteComponent>
<SpriteComponent
_enabled="0"
_tags="enabled_in_world,item_bg"
image_file="data/ui_gfx/inventory/item_bg_projectile.png"
offset_x="10"
offset_y="19"
z_index="-1.5"
></SpriteComponent>
<ItemActionComponent
_tags="enabled_in_world"
action_id=""
></ItemActionComponent>
</Entity>

View File

@ -0,0 +1,70 @@
<Entity tags="card_action">
<ItemComponent
_tags="enabled_in_world"
play_spinning_animation="0"
preferred_inventory="FULL"
></ItemComponent>
<HitboxComponent
_tags="enabled_in_world"
aabb_min_x="-4"
aabb_max_x="4"
aabb_min_y="-3"
aabb_max_y="3"
></HitboxComponent>
<SimplePhysicsComponent
_tags="enabled_in_world"
></SimplePhysicsComponent>
<VelocityComponent
_tags="enabled_in_world"
></VelocityComponent>
<!-- <SpriteComponent
_tags="enabled_in_world,item_unlocked"
image_file="data/ui_gfx/gun_actions/unidentified.png"
offset_x="8"
offset_y="8"
></SpriteComponent>
<SpriteComponent
_tags="enabled_in_world,item_locked"
image_file="data/ui_gfx/gun_actions/unidentified.png"
offset_x="8"
offset_y="8"
></SpriteComponent> -->
<SpriteComponent
_tags="enabled_in_world,item_identified"
image_file="data/ui_gfx/gun_actions/empty.png"
offset_x="8"
offset_y="17"
z_index="-1.51"
></SpriteComponent>
<SpriteComponent
_enabled="0"
_tags="enabled_in_world,item_unidentified"
image_file="data/ui_gfx/gun_actions/unidentified.png"
offset_x="8"
offset_y="17"
z_index="-1.51"
></SpriteComponent>
<SpriteComponent
_enabled="0"
_tags="enabled_in_world,item_bg"
image_file="data/ui_gfx/inventory/item_bg_projectile.png"
offset_x="10"
offset_y="19"
z_index="-1.5"
></SpriteComponent>
<ItemActionComponent
_tags="enabled_in_world"
action_id=""
></ItemActionComponent>
</Entity>

View File

@ -0,0 +1,153 @@
<Entity tags="card_action,energy_shield">
<ItemComponent
_tags="enabled_in_world"
play_spinning_animation="0"
preferred_inventory="FULL"
></ItemComponent>
<HitboxComponent
_tags="enabled_in_world"
aabb_min_x="-4"
aabb_max_x="4"
aabb_min_y="-3"
aabb_max_y="3"
></HitboxComponent>
<SimplePhysicsComponent
_tags="enabled_in_world"
></SimplePhysicsComponent>
<VelocityComponent
_tags="enabled_in_world"
></VelocityComponent>
<SpriteComponent
_tags="enabled_in_world,item_identified"
image_file="data/ui_gfx/gun_actions/energy_shield.png"
offset_x="8"
offset_y="17"
z_index="-1.51" >
</SpriteComponent>
<SpriteComponent
_enabled="0"
_tags="enabled_in_world,item_unidentified"
image_file="data/ui_gfx/gun_actions/unidentified.png"
offset_x="8"
offset_y="17"
z_index="-1.51" >
</SpriteComponent>
<SpriteComponent
_enabled="0"
_tags="enabled_in_world,item_bg"
image_file="data/ui_gfx/inventory/item_bg_projectile.png"
offset_x="10"
offset_y="19"
z_index="-1.5"
></SpriteComponent>
<ItemActionComponent
_tags="enabled_in_world"
action_id="ENERGY_SHIELD" >
</ItemActionComponent>
<InheritTransformComponent
_tags="enabled_in_hand"
use_root_parent="1">
<Transform
position.x="0"
position.y="-4" >
</Transform>
</InheritTransformComponent>
<EnergyShieldComponent
_tags="enabled_in_hand,item_identified__LEGACY"
recharge_speed="0.25"
radius="16.0"
>
</EnergyShieldComponent>
<ParticleEmitterComponent
_tags="character,enabled_in_hand,item_identified__LEGACY"
emitted_material_name="plasma_fading"
gravity.y="0.0"
lifetime_min="0.1"
lifetime_max="0.5"
count_min="2"
count_max="4"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.max="16"
cosmetic_force_create="0"
airflow_force="0.5"
airflow_time="0.1"
airflow_scale="0.5"
emission_interval_min_frames="1"
emission_interval_max_frames="1"
emit_cosmetic_particles="1"
is_emitting="1" >
</ParticleEmitterComponent>
<ParticleEmitterComponent
_tags="character,enabled_in_hand,item_identified__LEGACY,shield_ring"
emitted_material_name="plasma_fading"
gravity.y="0.0"
lifetime_min="0.02"
lifetime_max="0.05"
count_min="90"
count_max="100"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.min="16"
area_circle_radius.max="16"
cosmetic_force_create="0"
airflow_force="0.3"
airflow_time="0.01"
airflow_scale="0.05"
emission_interval_min_frames="0"
emission_interval_max_frames="0"
emit_cosmetic_particles="1"
is_emitting="1" >
</ParticleEmitterComponent>
<ParticleEmitterComponent
_tags="character,enabled_in_hand,item_identified__LEGACY,shield_hit"
emitted_material_name="plasma_fading"
gravity.y="0.0"
lifetime_min="0.3"
lifetime_max="1"
count_min="300"
count_max="360"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.min="16"
area_circle_radius.max="16"
cosmetic_force_create="0"
airflow_force="2.8"
airflow_time="0.03"
airflow_scale="0.8"
emission_interval_min_frames="0"
emission_interval_max_frames="0"
emit_cosmetic_particles="1"
is_emitting="0" >
</ParticleEmitterComponent>
<LightComponent
_tags="enabled_in_hand,item_identified"
_enabled="1"
radius="80"
fade_out_time="1.5"
r="150"
g="190"
b="230" >
</LightComponent>
<AudioComponent
_tags="enabled_in_hand,item_identified"
file="data/audio/Desktop/projectiles.bank"
event_root="player_projectiles/shield"
set_latest_event_position="1" >
</AudioComponent>
</Entity>

View File

@ -45,7 +45,7 @@ local componentTypeNamesToDisable = {
"DamageModelComponent",
"PhysicsBodyCollisionDamageComponent",
"ExplodeOnDamageComponent",
"SpriteOffsetAnimatorComponent",
--"SpriteOffsetAnimatorComponent",
--"PhysicsBody2Component", -- Disabling will hide barrels and similar stuff, also triggers an assertion.
--"PhysicsBodyComponent",
--"VelocityComponent", -- Disabling this component may cause a "...\component_updators\advancedfishai_system.cpp at line 107" exception.
@ -125,13 +125,13 @@ local function captureEntities(entityFile, x, y, radius)
end
-- Disable the hover animation of cards. Disabling the "SpriteOffsetAnimatorComponent" does not help.
local components = rootEntity:GetComponents("SpriteOffsetAnimatorComponent")
for _, component in ipairs(components) do
component:SetValue("x_speed", 0)
component:SetValue("y_speed", 0)
component:SetValue("x_amount", 0)
component:SetValue("y_amount", 0)
end
--local components = rootEntity:GetComponents("SpriteOffsetAnimatorComponent")
--for _, component in ipairs(components) do
-- component:SetValue("x_speed", 0)
-- component:SetValue("y_speed", 0)
-- component:SetValue("x_amount", 0)
-- component:SetValue("y_amount", 0)
--end
end
end

View File

@ -23,6 +23,14 @@ local EntityAPI = {}
local NoitaEntity = {}
NoitaEntity.__index = NoitaEntity
---WrapID wraps the given entity ID and returns a Noita entity object.
---@param id number
---@return NoitaEntity|nil
function EntityAPI.WrapID(id)
if id == nil or type(id) ~= "number" then return nil end
return setmetatable({ ID = id }, NoitaEntity)
end
local ComponentAPI = {}
---@class NoitaComponent
@ -30,6 +38,14 @@ local ComponentAPI = {}
local NoitaComponent = {}
NoitaComponent.__index = NoitaComponent
---WrapID wraps the given component ID and returns a Noita component object.
---@param id number
---@return NoitaComponent|nil
function ComponentAPI.WrapID(id)
if id == nil or type(id) ~= "number" then return nil end
return setmetatable({ ID = id }, NoitaComponent)
end
-------------------------
-- JSON Implementation --
-------------------------

View File

@ -0,0 +1,26 @@
-- Copyright (c) 2022 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
---@type NoitaAPI
local noitaAPI = dofile_once("mods/noita-mapcap/files/noita-api.lua")
local oldPerkSpawn = perk_spawn
---Spawns a perk.
---@param x number
---@param y number
---@param perkID integer
---@param dontRemoveOtherPerks boolean
---@return NoitaEntity|nil
function perk_spawn(x, y, perkID, dontRemoveOtherPerks)
local entity = noitaAPI.Entity.WrapID(oldPerkSpawn(x, y, perkID, dontRemoveOtherPerks))
if entity == nil then return end
-- Remove the SpriteOffsetAnimatorComponent components from the entity.
local components = entity:GetComponents("SpriteOffsetAnimatorComponent")
for _, component in ipairs(components) do
entity:RemoveComponent(component)
end
end

View File

@ -1,3 +1,8 @@
-- Copyright (c) 2022 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
dofile("mods/noita-mapcap/files/init.lua")
function OnPlayerSpawned(player_entity)
@ -11,3 +16,6 @@ function OnWorldPostUpdate() -- this is called every time the game has finished
end
ModMagicNumbersFileAdd("mods/noita-mapcap/files/magic_numbers.xml") -- override some game constants
-- Apply overrides.
ModLuaFileAppend("data/scripts/perks/perk.lua", "mods/noita-mapcap/files/overrides/perks/perk.lua" )