fix fungus dropping money and make last change better, remove stay away from material damage after a bit

This commit is contained in:
bgkillas 2024-10-29 16:54:32 -04:00
parent 8e477ba8b6
commit cdc2fc4bae
5 changed files with 15 additions and 532 deletions

View file

@ -1,173 +0,0 @@
<Entity name="$animal_fungus" >
<Base file="data/entities/base_enemy_basic.xml" >
<ItemChestComponent level="2" enemy_drop="1" > </ItemChestComponent>
<AnimalAIComponent
_enabled="1"
escape_if_damaged_probability="70"
food_material="blood"
attack_melee_enabled="0"
attack_melee_max_distance="1"
attack_dash_enabled="1"
attack_dash_lob="1.1"
attack_ranged_enabled="0"
aggressiveness_min="10"
aggressiveness_max="100"
>
</AnimalAIComponent>
<DamageModelComponent
hp="2.6"
air_needed="0"
ragdoll_filenames_file="data/ragdolls/fungus/filenames.txt"
fire_probability_of_ignition="100"
ragdoll_material="fungus_loose_trippy"
blood_material="blood_fungi"
blood_spray_material="blood_fungi"
blood_sprite_directional="data/particles/bloodsplatters/bloodsplatter_directional_purple_$[1-3].xml"
blood_sprite_large="data/particles/bloodsplatters/bloodsplatter_purple_$[1-3].xml"
minimum_knockback_force="100000"
>
<damage_multipliers
fire="40.0"
>
</damage_multipliers>
</DamageModelComponent>
<SpriteComponent
image_file="data/enemies_gfx/fungus.xml"
offset_x="0"
offset_y="0">
</SpriteComponent>
<PathFindingGridMarkerComponent
marker_work_flag="16" >
</PathFindingGridMarkerComponent>
<PathFindingComponent
frames_to_get_stuck="120"
can_jump="1"
never_consider_line_of_sight="1"
>
</PathFindingComponent>
<GenomeDataComponent
herd_id="fungus"
food_chain_rank="15"
is_predator="1" >
</GenomeDataComponent>
<CharacterPlatformingComponent
jump_velocity_y="-12"
run_velocity="9" >
</CharacterPlatformingComponent>
<CameraBoundComponent
max_count="30"
distance="160000">
</CameraBoundComponent>
<HitboxComponent
_enabled="1"
aabb_max_x="6"
aabb_max_y="4"
aabb_min_x="-6"
aabb_min_y="-10" >
</HitboxComponent>
<CharacterDataComponent
collision_aabb_min_x="-3.0"
collision_aabb_max_x="3.0"
collision_aabb_min_y="-10"
collision_aabb_max_y="3"
mass="1.3"
>
</CharacterDataComponent>
<AudioComponent
file="data/audio/Desktop/animals.bank"
event_root="animals/slime">
</AudioComponent>
</Base>
<MaterialInventoryComponent
_enabled="1"
drop_as_item="0"
leak_on_damage_percent="0.999"
>
<count_per_material_type>
<Material material="blood_fungi" count="400" />
</count_per_material_type>
</MaterialInventoryComponent>
<LuaComponent
script_death="data/scripts/animals/fungus_death.lua"
>
</LuaComponent>
<LuaComponent
execute_on_removed="0"
execute_every_n_frame="-1"
script_collision_trigger_timer_finished="data/scripts/animals/fungus_death.lua"
remove_after_executed="1">
</LuaComponent>
<LuaComponent
execute_on_removed="0"
execute_every_n_frame="-1"
script_collision_trigger_hit="data/scripts/animals/fungus_smoke.lua"
remove_after_executed="1">
</LuaComponent>
<CollisionTriggerComponent
width="10"
height="10"
radius="5"
required_tag="mortal"
destroy_this_entity_when_triggered="0"
remove_component_when_triggered="1"
timer_for_destruction="20" >
</CollisionTriggerComponent>
<CollisionTriggerComponent
width="10"
height="10"
radius="5"
required_tag="mortal"
timer_for_destruction="0"
destroy_this_entity_when_triggered="0"
remove_component_when_triggered="1"
>
</CollisionTriggerComponent>
<ParticleEmitterComponent
emitted_material_name="acid_gas"
offset.x="0"
offset.y="0"
x_pos_offset_min="-2"
y_pos_offset_min="-2"
x_pos_offset_max="2"
y_pos_offset_max="2"
x_vel_min="-10"
x_vel_max="10"
y_vel_min="-10"
y_vel_max="10"
count_min="1"
count_max="2"
lifetime_min="0.6"
lifetime_max="1.8"
create_real_particles="1"
emit_cosmetic_particles="0"
emission_interval_min_frames="10"
emission_interval_max_frames="35"
is_emitting="1" >
</ParticleEmitterComponent>
<AudioComponent
file="data/audio/Desktop/animals.bank"
event_root="animals/fungus" >
</AudioComponent>
</Entity>

View file

@ -1,174 +0,0 @@
<Entity name="$animal_fungus_big" >
<Base file="data/entities/base_enemy_basic.xml" >
<ItemChestComponent level="2" enemy_drop="1" > </ItemChestComponent>
<AnimalAIComponent
_enabled="1"
escape_if_damaged_probability="70"
food_material="blood"
attack_melee_enabled="0"
attack_melee_max_distance="1"
attack_dash_enabled="1"
attack_dash_lob="1.1"
attack_ranged_enabled="0"
aggressiveness_min="10"
aggressiveness_max="100"
attack_dash_damage="0.4"
>
</AnimalAIComponent>
<DamageModelComponent
hp="7.6"
air_needed="0"
ragdoll_filenames_file="data/ragdolls/fungus_big/filenames.txt"
fire_probability_of_ignition="20"
ragdoll_material="fungus_loose_trippy"
blood_material="blood_fungi"
blood_spray_material="blood_fungi"
blood_sprite_directional="data/particles/bloodsplatters/bloodsplatter_directional_purple_$[1-3].xml"
blood_sprite_large="data/particles/bloodsplatters/bloodsplatter_purple_$[1-3].xml"
minimum_knockback_force="100000"
>
<damage_multipliers
fire="2.0"
>
</damage_multipliers>
</DamageModelComponent>
<SpriteComponent
image_file="data/enemies_gfx/fungus_big.xml"
offset_x="0"
offset_y="0">
</SpriteComponent>
<PathFindingGridMarkerComponent
marker_work_flag="16" >
</PathFindingGridMarkerComponent>
<PathFindingComponent
frames_to_get_stuck="120"
can_jump="1"
never_consider_line_of_sight="1"
>
</PathFindingComponent>
<GenomeDataComponent
herd_id="fungus"
food_chain_rank="15"
is_predator="1" >
</GenomeDataComponent>
<CharacterPlatformingComponent
jump_velocity_y="-18"
run_velocity="14" >
</CharacterPlatformingComponent>
<CameraBoundComponent
max_count="30"
distance="160000">
</CameraBoundComponent>
<HitboxComponent
_enabled="1"
aabb_max_x="6"
aabb_max_y="4"
aabb_min_x="-6"
aabb_min_y="-16" >
</HitboxComponent>
<CharacterDataComponent
collision_aabb_min_x="-4.0"
collision_aabb_max_x="4.0"
collision_aabb_min_y="-14"
collision_aabb_max_y="3"
mass="1.3"
>
</CharacterDataComponent>
<AudioComponent
file="data/audio/Desktop/animals.bank"
event_root="animals/slime">
</AudioComponent>
</Base>
<MaterialInventoryComponent
_enabled="1"
drop_as_item="0"
leak_on_damage_percent="0.999"
>
<count_per_material_type>
<Material material="blood_fungi" count="400" />
</count_per_material_type>
</MaterialInventoryComponent>
<LuaComponent
script_death="data/scripts/animals/fungus_big_death.lua"
>
</LuaComponent>
<LuaComponent
execute_on_removed="0"
execute_every_n_frame="-1"
script_collision_trigger_timer_finished="data/scripts/animals/fungus_big_death.lua"
remove_after_executed="1">
</LuaComponent>
<LuaComponent
execute_on_removed="0"
execute_every_n_frame="-1"
script_collision_trigger_hit="data/scripts/animals/fungus_smoke.lua"
remove_after_executed="1">
</LuaComponent>
<CollisionTriggerComponent
width="10"
height="10"
radius="5"
required_tag="mortal"
destroy_this_entity_when_triggered="0"
remove_component_when_triggered="1"
timer_for_destruction="40" >
</CollisionTriggerComponent>
<CollisionTriggerComponent
width="10"
height="10"
radius="5"
required_tag="mortal"
timer_for_destruction="0"
destroy_this_entity_when_triggered="0"
remove_component_when_triggered="1"
>
</CollisionTriggerComponent>
<ParticleEmitterComponent
emitted_material_name="acid_gas"
offset.x="0"
offset.y="0"
x_pos_offset_min="-2"
y_pos_offset_min="-2"
x_pos_offset_max="2"
y_pos_offset_max="2"
x_vel_min="-10"
x_vel_max="10"
y_vel_min="-10"
y_vel_max="10"
count_min="1"
count_max="2"
lifetime_min="0.6"
lifetime_max="1.8"
create_real_particles="1"
emit_cosmetic_particles="0"
emission_interval_min_frames="2"
emission_interval_max_frames="10"
is_emitting="1" >
</ParticleEmitterComponent>
<AudioComponent
file="data/audio/Desktop/animals.bank"
event_root="animals/fungus" >
</AudioComponent>
</Entity>

View file

@ -1,177 +0,0 @@
<Entity name="$animal_fungus_tiny" tags="fungus_tiny_bad" >
<Base file="data/entities/base_enemy_basic.xml" >
<ItemChestComponent level="2" enemy_drop="1" > </ItemChestComponent>
<AnimalAIComponent
_enabled="1"
escape_if_damaged_probability="70"
food_material="blood"
attack_melee_enabled="0"
attack_melee_max_distance="1"
attack_dash_enabled="1"
attack_dash_lob="1.1"
attack_ranged_enabled="0"
aggressiveness_min="10"
aggressiveness_max="100"
>
</AnimalAIComponent>
<DamageModelComponent
hp="1.6"
air_needed="0"
ragdoll_filenames_file=""
fire_probability_of_ignition="100"
ragdoll_material="fungus_loose_trippy"
blood_material="blood_fungi"
blood_spray_material="blood_fungi"
blood_sprite_directional="data/particles/bloodsplatters/bloodsplatter_directional_purple_$[1-3].xml"
blood_sprite_large="data/particles/bloodsplatters/bloodsplatter_purple_$[1-3].xml"
minimum_knockback_force="100000"
>
<damage_multipliers
fire="40.0"
>
</damage_multipliers>
</DamageModelComponent>
<SpriteComponent
image_file="data/enemies_gfx/fungus_tiny_b.xml"
offset_x="0"
offset_y="0">
</SpriteComponent>
<PathFindingGridMarkerComponent
marker_work_flag="16" >
</PathFindingGridMarkerComponent>
<PathFindingComponent
frames_to_get_stuck="120"
can_jump="1"
never_consider_line_of_sight="1"
>
</PathFindingComponent>
<GenomeDataComponent
herd_id="fungus"
food_chain_rank="15"
is_predator="1" >
</GenomeDataComponent>
<CharacterPlatformingComponent
jump_velocity_y="-12"
run_velocity="9" >
</CharacterPlatformingComponent>
<CameraBoundComponent
max_count="30"
distance="160000">
</CameraBoundComponent>
<HitboxComponent
_enabled="1"
aabb_max_x="4"
aabb_max_y="4"
aabb_min_x="-4"
aabb_min_y="-8" >
</HitboxComponent>
<CharacterDataComponent
collision_aabb_min_x="-1.0"
collision_aabb_max_x="1.0"
collision_aabb_min_y="-6"
collision_aabb_max_y="3"
mass="1.3"
>
</CharacterDataComponent>
<AudioComponent
file="data/audio/Desktop/animals.bank"
event_root="animals/slime">
</AudioComponent>
</Base>
<MaterialInventoryComponent
_enabled="1"
drop_as_item="0"
leak_on_damage_percent="0.999"
>
<count_per_material_type>
<Material material="blood_fungi" count="400" />
</count_per_material_type>
</MaterialInventoryComponent>
<LuaComponent
script_death="data/scripts/animals/fungus_death.lua"
>
</LuaComponent>
<LuaComponent
execute_on_removed="0"
execute_every_n_frame="-1"
script_collision_trigger_timer_finished="data/scripts/animals/fungus_death.lua"
remove_after_executed="1">
</LuaComponent>
<LuaComponent
execute_on_removed="0"
execute_every_n_frame="-1"
script_collision_trigger_hit="data/scripts/animals/fungus_smoke.lua"
remove_after_executed="1">
</LuaComponent>
<CollisionTriggerComponent
width="10"
height="10"
radius="5"
required_tag="player_unit"
destroy_this_entity_when_triggered="0"
remove_component_when_triggered="1"
timer_for_destruction="20" >
</CollisionTriggerComponent>
<CollisionTriggerComponent
width="10"
height="10"
radius="5"
required_tag="player_unit"
timer_for_destruction="0"
destroy_this_entity_when_triggered="0"
remove_component_when_triggered="1"
>
</CollisionTriggerComponent>
<ParticleEmitterComponent
emitted_material_name="acid_gas"
offset.x="0"
offset.y="0"
x_pos_offset_min="-2"
y_pos_offset_min="-2"
x_pos_offset_max="2"
y_pos_offset_max="2"
x_vel_min="-10"
x_vel_max="10"
y_vel_min="-10"
y_vel_max="10"
count_min="1"
count_max="2"
lifetime_min="0.6"
lifetime_max="1.8"
create_real_particles="1"
emit_cosmetic_particles="0"
emission_interval_min_frames="10"
emission_interval_max_frames="35"
is_emitting="1" >
</ParticleEmitterComponent>
<AudioComponent
file="data/audio/Desktop/animals.bank"
event_root="animals/fungus" >
</AudioComponent>
<VariableStorageComponent
_tags="no_gold_drop">
</VariableStorageComponent>
</Entity>

View file

@ -644,6 +644,7 @@ local function choose_movement()
on_right = false
local damage_model = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "DamageModelComponent")
local start = (state.dtype == 32 or state.init_timer < 100) and ComponentGetValue2(damage_model, "mLiquidCount") ~= 0
state.dtype = 0
if start or move > GameGetFrameNum() then
if start then
move = GameGetFrameNum() + 120
@ -766,7 +767,8 @@ local function choose_movement()
for i = #state.stay_away, 1, -1 do
local pos = state.stay_away[i]
local x, y = pos[1], pos[2]
if pos[3] ~= nil and not EntityGetIsAlive(pos[3]) then
if (pos[3] ~= nil and not EntityGetIsAlive(pos[3]))
or (pos[4] ~= nil and pos[4] < GameGetFrameNum()) then
table.remove(state.stay_away, i)
else
local pdx, pdy = x - my_x, y - my_y
@ -792,7 +794,7 @@ local function choose_movement()
local damage_model = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "DamageModelComponent")
if ComponentGetValue2(damage_model, "mLiquidCount") == 0 then
if state.dtype == 32 or material_gas > GameGetFrameNum() then
table.insert(state.stay_away, {my_x, my_y - 4})
table.insert(state.stay_away, {my_x, my_y - 4, nil, GameGetFrameNum() + 600})
material_gas = GameGetFrameNum() + 30
if (dist > 0 and did_hit_2) or (dist < 0 and did_hit_1) then
give_space = give_space + 10
@ -816,7 +818,7 @@ local function choose_movement()
end
end
elseif state.dtype == 32 or state.init_timer < 100 then
table.insert(state.stay_away, {my_x, my_y + 4})
table.insert(state.stay_away, {my_x, my_y + 4, nil, GameGetFrameNum() + 600})
move = GameGetFrameNum() + 120
state.control_w = true
if my_x > t_x then
@ -838,6 +840,7 @@ local function choose_movement()
else
move = -1
end
state.dtype = 0
if is_froze and math.abs(dist) < 10 then
state.control_w = false
end
@ -1237,9 +1240,6 @@ local kick_wait = 0
local function update()
local var = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "VariableStorageComponent", "ew_damage_tracker")
if GameGetFrameNum() % 30 == 0 then
ComponentSetValue2(var, "value_int", 0)
end
state.dtype = ComponentGetValue2(var, "value_int")
-- No taking control back, even after pressing esc.
ComponentSetValue2(state.control_component, "enabled", false)
@ -1308,7 +1308,8 @@ local function update()
if state.target ~= nil
and water_potion == nil and good_potion == nil and bad_potion == nil
and not state.last_did_hit then
and not state.last_did_hit
and state.init_timer > 100 then
local hp = util.get_ent_health(state.target)
if state.good_wands[state.target] == nil then
state.good_wands[state.target] = {}

View file

@ -21,7 +21,13 @@ local function entity_changed()
print("Player entity is equal to WSE, skipping...")
return
end
for _, com in ipairs(EntityGetComponent(ctx.my_player.entity, "CollisionTriggerComponent") or {}) do
if ComponentGetValue2(com, "destroy_this_entity_when_triggered") then
ComponentSetValue2(com, "destroy_this_entity_when_triggered", false)
ComponentSetValue2(com, "remove_component_when_triggered", true)
end
end
rpc.change_entity({data = util.serialize_entity(ctx.my_player.entity)})
else
rpc.change_entity(nil)