dont send clients extra hp perk, fix potion mimic duping

This commit is contained in:
bgkillas 2024-11-13 17:43:36 -05:00
parent 43c24a8f3d
commit ccf6c574b3
5 changed files with 136 additions and 1 deletions

View file

@ -0,0 +1,93 @@
<Entity tags="teleportable_NOT,item_physics,item_pickup,effectable_prop">
<UIInfoComponent
name="$item_potion_mimic"
></UIInfoComponent>
<PositionSeedComponent />
<PhysicsBodyComponent
uid="1"
allow_sleep="1"
angular_damping="0"
fixed_rotation="0"
is_bullet="1"
linear_damping="0"
auto_clean="0"
on_death_leave_physics_body="0"
hax_fix_going_through_ground="1"
></PhysicsBodyComponent>
<PhysicsImageShapeComponent
body_id="1"
centered="1"
image_file="data/items_gfx/potion_normals.png"
material="potion_glass_box2d"
></PhysicsImageShapeComponent>
<ItemComponent
item_name="$item_potion_mimic"
play_spinning_animation="0"
stats_count_as_item_pick_up="0"
play_pick_sound="0" >
</ItemComponent>
<LuaComponent
script_physics_body_modified="data/scripts/items/potion_mimic.lua"
script_item_picked_up="data/scripts/items/potion_mimic.lua"
script_collision_trigger_hit="data/scripts/items/potion_mimic.lua"
execute_times="1"
>
</LuaComponent>
<CollisionTriggerComponent
width="30"
height="30"
radius="30"
required_tag="ew_peer"
>
</CollisionTriggerComponent>
<LightComponent
_tags="enabled_in_world"
r="255"
g="255"
b="255"
radius="64"
fade_out_time="0.75" >
</LightComponent>
<SpriteParticleEmitterComponent
sprite_file="data/particles/ray.xml"
delay="0"
lifetime="1.5"
color.r="1" color.g="0.5" color.b="1" color.a="1.0"
color_change.r="0" color_change.g="0" color_change.b="0" color_change.a="-3.5"
velocity.x="0" velocity.y="0"
gravity.x="0" gravity.y="0"
velocity_slowdown="0"
rotation="0"
angular_velocity="0"
scale.x="1" scale.y="0"
scale_velocity.x="-0.3" scale_velocity.y="3"
emission_interval_min_frames="3"
emission_interval_max_frames="6"
emissive="1"
additive="1"
count_min="1" count_max="1"
use_velocity_as_rotation="1"
randomize_position.min_x="-2"
randomize_position.max_x="2"
randomize_position.min_y="-2"
randomize_position.max_y="2"
randomize_velocity.min_x="-30"
randomize_velocity.max_x="30"
randomize_velocity.min_y="-30"
randomize_velocity.max_y="30"
velocity_always_away_from_center="1">
</SpriteParticleEmitterComponent>
<PotionComponent
custom_color_material="magic_liquid_hp_regeneration"
></PotionComponent>
</Entity>

View file

@ -0,0 +1,27 @@
dofile_once("data/scripts/lib/utilities.lua")
function spawn_leggy( entity_item )
if not GameHasFlagRun("ew_flag_this_is_host") then
return
end
local x, y = EntityGetTransform( entity_item )
EntityLoad( "data/entities/particles/polymorph_explosion.xml", x, y )
GamePlaySound( "data/audio/Desktop/misc.bank", "game_effect/polymorph/create", x, y );
EntityLoad( "data/entities/animals/mimic_potion.xml", x, y )
EntityKill( entity_item )
end
function item_pickup( entity_item, entity_who_picked, name )
spawn_leggy( entity_item )
end
function physics_body_modified( is_destroyed )
local entity_item = GetUpdatedEntityID()
spawn_leggy( entity_item )
end
function collision_trigger( colliding_entity_id )
local entity_item = GetUpdatedEntityID()
spawn_leggy( entity_item )
end

View file

@ -18,6 +18,7 @@ local perks_to_ignore = {
FASTER_WANDS = true, FASTER_WANDS = true,
EXTRA_MANA = true, EXTRA_MANA = true,
TELEKINESIS = true, TELEKINESIS = true,
HEARTS_MORE_EXTRA_HP = true,
} }
local global_perks = { local global_perks = {

View file

@ -165,6 +165,8 @@ local function allow_notplayer_perk(perk_id)
ESSENCE_WATER = true, ESSENCE_WATER = true,
LUKKI_MINION = true, LUKKI_MINION = true,
CONTACT_DAMAGE = true, CONTACT_DAMAGE = true,
HEARTS_MORE_EXTRA_HP = true,
REVENGE_RATS = true,
FOOD_CLOCK = true, -- TODO, should carry over satiation buff FOOD_CLOCK = true, -- TODO, should carry over satiation buff
} }
return not ignored_perks[perk_id] return not ignored_perks[perk_id]
@ -250,6 +252,18 @@ local function player_died()
ComponentSetValue2(inv, "mItemHolstered", false) ComponentSetValue2(inv, "mItemHolstered", false)
ComponentSetValue2(inv, "mActualActiveItem", 0) ComponentSetValue2(inv, "mActualActiveItem", 0)
ComponentSetValue2(inv, "mActiveItem", 0) ComponentSetValue2(inv, "mActiveItem", 0)
local quick
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
if EntityGetName(child) == "inventory_quick" then
quick = child
break
end
end
for _, child in ipairs(EntityGetAllChildren(quick) or {}) do
EntitySetComponentsWithTagEnabled(child, "enabled_in_hand", false)
EntitySetComponentsWithTagEnabled(child, "enabled_in_world", false)
EntitySetComponentsWithTagEnabled(child, "enabled_in_inventory", true)
end
end end
polymorph.switch_entity(ent + 1) polymorph.switch_entity(ent + 1)

View file

@ -60,7 +60,7 @@ local water_mats = {"water", "swamp", "water_swamp", "water_salt", "blood", "mud
local ignore_spell = {"ANTIHEAL", "BLACK_HOLE", "BLACK_HOLE_DEATH_TRIGGER", "POWERDIGGER", "DIGGER", "PIPE_BOMB", "PIPE_BOMB_DEATH_TRIGGER", "GRENADE_LARGE", "CRUMBLING_EARTH", "HEAL_BULLET", "FISH", local ignore_spell = {"ANTIHEAL", "BLACK_HOLE", "BLACK_HOLE_DEATH_TRIGGER", "POWERDIGGER", "DIGGER", "PIPE_BOMB", "PIPE_BOMB_DEATH_TRIGGER", "GRENADE_LARGE", "CRUMBLING_EARTH", "HEAL_BULLET", "FISH",
"TELEPORT_PROJECTILE_CLOSER", "TELEPORT_PROJECTILE_STATIC", "SWAPPER_PROJECTILE", "TELEPORT_PROJECTILE", "TELEPORT_PROJECTILE_SHORT", "WHITE_HOLE", "CESSATION", "ADD_TRIGGER", "TELEPORT_PROJECTILE_CLOSER", "TELEPORT_PROJECTILE_STATIC", "SWAPPER_PROJECTILE", "TELEPORT_PROJECTILE", "TELEPORT_PROJECTILE_SHORT", "WHITE_HOLE", "CESSATION", "ADD_TRIGGER",
"ADD_TIMER", "ADD_DEATH_TRIGGER", "DIVIDE_2", "DIVIDE_3", "DIVIDE_4", "DIVIDE_10", "GAMMA", "MU", "ALPHA", "OMEGA", "PHI", "SIGMA", "TAU", "SUMMON_PORTAL", "DUPLICATE", "ADD_TIMER", "ADD_DEATH_TRIGGER", "DIVIDE_2", "DIVIDE_3", "DIVIDE_4", "DIVIDE_10", "GAMMA", "MU", "ALPHA", "OMEGA", "PHI", "SIGMA", "TAU", "SUMMON_PORTAL", "DUPLICATE",
"IF_PROJECTILE", "IF_HP", "IF_ENEMY", "IF_HALF", "IF_ELSE", "IF_END", "ALL_SPELLS", "SUMMON_ROCK", "SUMMON_EGG"} "IF_PROJECTILE", "IF_HP", "IF_ENEMY", "IF_HALF", "IF_ELSE", "IF_END", "ALL_SPELLS", "SUMMON_ROCK", "SUMMON_EGG", "SUMMON_HOLLOW_EGG", "PEBBLE"}
local function get_potions_of_type(type) local function get_potions_of_type(type)
local potions = {} local potions = {}