sync angry ghost memory, make stevari spawn nicer, sync gate boss / tiny / tapion spawn, dont disable movement in pause menues

This commit is contained in:
bgkillas 2024-10-13 18:58:22 -04:00
parent f2f8f9f0b0
commit 8ae4052480
22 changed files with 640 additions and 260 deletions

View file

@ -0,0 +1,19 @@
dofile_once("data/scripts/lib/utilities.lua")
local entity_id = GetUpdatedEntityID()
local x, y = EntityGetTransform( GetUpdatedEntityID() )
local anger = tonumber( GlobalsGetValue( "HELPLESS_KILLS", "1" ) ) or 1
local p = EntityGetInRadiusWithTag( x, y, 200, "ew_peer" )
if ( #p > 0 ) and ( anger >= 30 ) and ( GlobalsGetValue( "ISLANDSPIRIT_SPAWNED", "0" ) == "0" ) then
GlobalsSetValue( "ISLANDSPIRIT_SPAWNED", "1" )
if GameHasFlagRun("ew_flag_this_is_host") then
EntityLoad( "data/entities/animals/boss_spirit/spawn_portal.xml", x, y )
else
EntityLoad( "mods/quant.ew/files/system/tapion/spawn_portal.xml", x, y )
end
EntityKill( entity_id )
end

View file

@ -5,10 +5,10 @@
radius="60"
destroy_this_entity_when_triggered="1"
required_tag="ew_peer" >
</CollisionTriggerComponent>
</CollisionTriggerComponent>
<LuaComponent
script_collision_trigger_hit="data/scripts/buildings/orb_07_pitcheck_a.lua"
execute_every_n_frame="-1" >
</LuaComponent>
</Entity>
</Entity>

View file

@ -1,19 +1,19 @@
<Entity tags="pitcheck_b">
<CollisionTriggerComponent
_enabled="0"
_tags="disabled"
_enabled="0"
_tags="disabled"
width="96"
height="430"
radius="430"
destroy_this_entity_when_triggered="0"
required_tag="ew_peer" >
</CollisionTriggerComponent>
</CollisionTriggerComponent>
<!-- this spawns squidward -->
<LuaComponent
_enabled="0"
_tags="disabled"
_enabled="0"
_tags="disabled"
script_collision_trigger_hit="data/scripts/buildings/orb_07_pitcheck_b.lua"
execute_every_n_frame="-1" >
</LuaComponent>
</Entity>
</Entity>

View file

@ -0,0 +1,16 @@
dofile_once("data/scripts/lib/utilities.lua")
if not GameHasFlagRun("ew_flag_this_is_host") then
return
end
local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id )
local t = EntityGetInRadiusWithTag( pos_x, pos_y, 220, "ew_peer" )
if ( #t > 0 ) then
EntityLoad( "data/entities/animals/maggot_tiny/maggot_tiny.xml", pos_x, pos_y )
EntityLoad( "data/entities/particles/image_emitters/magical_symbol_fast.xml", pos_x, pos_y )
EntityKill( entity_id )
end

View file

@ -0,0 +1,108 @@
dofile_once("data/scripts/lib/utilities.lua")
local distance_full = 90
local max_egg_count = 3
local entity_id = GetUpdatedEntityID()
local x, y = EntityGetTransform( entity_id )
local x_orig = x
local y_orig = y
if not is_in_camera_bounds(x,y,300) then return end
-- center position drifts around
local time = GameGetFrameNum()
local t = time * 0.02
x = x + math.sin(t) * 20
y = y + math.cos(t) * 20
-- offset tweaks
x = x + 10
y = y - 20
function calculate_force_at(body_x, body_y)
local distance = math.sqrt( ( x - body_x ) ^ 2 + ( y - body_y ) ^ 2 )
local direction = 0 - math.atan2( ( y - body_y ), ( x - body_x ) )
local gravity_percent = ( distance_full - distance ) / distance_full
local gravity_coeff = 50
local fx = math.cos( direction ) * ( gravity_coeff * gravity_percent )
local fy = -math.sin( direction ) * ( gravity_coeff * gravity_percent )
return fx,fy
end
-- repel projectiles
local entities = EntityGetInRadiusWithTag(x, y, distance_full, "projectile")
for _,id in ipairs(entities) do
local physicscomp = EntityGetFirstComponent(id, "PhysicsBody2Component") or EntityGetFirstComponent( id, "PhysicsBodyComponent")
if physicscomp == nil then -- velocity for physics bodies is done later
local px, py = EntityGetTransform( id )
local velocitycomp = EntityGetFirstComponent( id, "VelocityComponent" )
if ( velocitycomp ~= nil ) then
local fx, fy = calculate_force_at(px, py)
edit_component( id, "VelocityComponent", function(comp,vars)
local vel_x,vel_y = ComponentGetValue2( comp, "mVelocity")
vel_x = vel_x - fx
vel_y = vel_y - fy
vel_y = vel_y * 0.85 -- dampen vertical movement
-- limit velocity
vel_x = clamp(vel_x, -100, 100)
vel_y = clamp(vel_y, -100, 100)
ComponentSetValue2( comp, "mVelocity", vel_x, vel_y)
end)
end
end
end
-- force field for physics bodies
function calculate_force_for_body( entity, body_mass, body_x, body_y, body_vel_x, body_vel_y, body_vel_angular )
local fx, fy = calculate_force_at(body_x, body_y)
fx = fx * 1.5 * body_mass
fy = fy * 1.5 * body_mass
return body_x,body_y,-fx,-fy,0 -- forcePosX,forcePosY,forceX,forceY,forceAngular
end
local size = distance_full * 0.5
PhysicsApplyForceOnArea( calculate_force_for_body, entity_id, x-size, y-size, x+size, y+size )
-- let's egg!
for _,id in ipairs(EntityGetInRadiusWithTag(x, y, 70, "egg_item")) do
if EntityGetRootEntity(id) == id then -- egg is not held
-- egg disappears
local egg_x, egg_y = EntityGetTransform(id)
EntityLoad("data/entities/buildings/wizardcave_gate_egg_fx.xml", egg_x, egg_y)
GamePlaySound( "data/audio/Desktop/projectiles.bank", "projectiles/magic/create", egg_x, egg_y )
EntityKill(id)
-- check egg count
if GameHasFlagRun("ew_flag_this_is_host") then
component_readwrite( get_variable_storage_component(entity_id, "egg_count"), { value_int = 0 }, function(comp)
comp.value_int = comp.value_int + 1
if comp.value_int == max_egg_count then
-- spawn monster spawner
EntityLoad("data/entities/buildings/wizardcave_gate_monster_spawner.xml", x_orig, y_orig)
-- audio
GamePlaySound( "data/audio/Desktop/projectiles.snd", "player_projectiles/crumbling_earth/create", x_orig, y_orig )
GameTriggerMusicFadeOutAndDequeueAll( 3.0 )
GameTriggerMusicEvent( "music/oneshot/04", true, x_orig, y_orig )
-- remove self
if GameHasFlagRun("ew_flag_this_is_host") then
CrossCall("ew_spawn_gate")
end
EntityKill(entity_id)
return
end
end)
end
end
end

View file

@ -26,50 +26,50 @@ local base64 = {}
local extract = _G.bit32 and _G.bit32.extract -- Lua 5.2/Lua 5.3 in compatibility mode
if not extract then
if _G.bit then -- LuaJIT
local shl, shr, band = _G.bit.lshift, _G.bit.rshift, _G.bit.band
extract = function( v, from, width )
return band( shr( v, from ), shl( 1, width ) - 1 )
end
elseif _G._VERSION == "Lua 5.1" then
extract = function( v, from, width )
local w = 0
local flag = 2^from
for i = 0, width-1 do
local flag2 = flag + flag
if v % flag2 >= flag then
w = w + 2^i
end
flag = flag2
end
return w
end
else -- Lua 5.3+
extract = load[[return function( v, from, width )
return ( v >> from ) & ((1 << width) - 1)
end]]()
end
if _G.bit then -- LuaJIT
local shl, shr, band = _G.bit.lshift, _G.bit.rshift, _G.bit.band
extract = function( v, from, width )
return band( shr( v, from ), shl( 1, width ) - 1 )
end
elseif _G._VERSION == "Lua 5.1" then
extract = function( v, from, width )
local w = 0
local flag = 2^from
for i = 0, width-1 do
local flag2 = flag + flag
if v % flag2 >= flag then
w = w + 2^i
end
flag = flag2
end
return w
end
else -- Lua 5.3+
extract = load[[return function( v, from, width )
return ( v >> from ) & ((1 << width) - 1)
end]]()
end
end
function base64.makeencoder( s62, s63, spad )
local encoder = {}
for b64code, char in pairs{[0]='A','B','C','D','E','F','G','H','I','J',
'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y',
'Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n',
'o','p','q','r','s','t','u','v','w','x','y','z','0','1','2',
'3','4','5','6','7','8','9',s62 or '+',s63 or'/',spad or'='} do
encoder[b64code] = char:byte()
end
return encoder
local encoder = {}
for b64code, char in pairs{[0]='A','B','C','D','E','F','G','H','I','J',
'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y',
'Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n',
'o','p','q','r','s','t','u','v','w','x','y','z','0','1','2',
'3','4','5','6','7','8','9',s62 or '+',s63 or'/',spad or'='} do
encoder[b64code] = char:byte()
end
return encoder
end
function base64.makedecoder( s62, s63, spad )
local decoder = {}
for b64code, charcode in pairs( base64.makeencoder( s62, s63, spad )) do
decoder[charcode] = b64code
end
return decoder
local decoder = {}
for b64code, charcode in pairs( base64.makeencoder( s62, s63, spad )) do
decoder[charcode] = b64code
end
return decoder
end
local DEFAULT_ENCODER = base64.makeencoder()
@ -78,82 +78,82 @@ local DEFAULT_DECODER = base64.makedecoder()
local char, concat = string.char, table.concat
function base64.encode( str, encoder, usecaching )
encoder = encoder or DEFAULT_ENCODER
local t, k, n = {}, 1, #str
local lastn = n % 3
local cache = {}
for i = 1, n-lastn, 3 do
local a, b, c = str:byte( i, i+2 )
local v = a*0x10000 + b*0x100 + c
local s
if usecaching then
s = cache[v]
if not s then
s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
cache[v] = s
end
else
s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
end
t[k] = s
k = k + 1
end
if lastn == 2 then
local a, b = str:byte( n-1, n )
local v = a*0x10000 + b*0x100
t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[64])
elseif lastn == 1 then
local v = str:byte( n )*0x10000
t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[64], encoder[64])
end
return concat( t )
encoder = encoder or DEFAULT_ENCODER
local t, k, n = {}, 1, #str
local lastn = n % 3
local cache = {}
for i = 1, n-lastn, 3 do
local a, b, c = str:byte( i, i+2 )
local v = a*0x10000 + b*0x100 + c
local s
if usecaching then
s = cache[v]
if not s then
s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
cache[v] = s
end
else
s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
end
t[k] = s
k = k + 1
end
if lastn == 2 then
local a, b = str:byte( n-1, n )
local v = a*0x10000 + b*0x100
t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[64])
elseif lastn == 1 then
local v = str:byte( n )*0x10000
t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[64], encoder[64])
end
return concat( t )
end
function base64.decode( b64, decoder, usecaching )
decoder = decoder or DEFAULT_DECODER
local pattern = '[^%w%+%/%=]'
if decoder then
local s62, s63
for charcode, b64code in pairs( decoder ) do
if b64code == 62 then s62 = charcode
elseif b64code == 63 then s63 = charcode
end
end
pattern = ('[^%%w%%%s%%%s%%=]'):format( char(s62), char(s63) )
end
b64 = b64:gsub( pattern, '' )
local cache = usecaching and {}
local t, k = {}, 1
local n = #b64
local padding = b64:sub(-2) == '==' and 2 or b64:sub(-1) == '=' and 1 or 0
for i = 1, padding > 0 and n-4 or n, 4 do
local a, b, c, d = b64:byte( i, i+3 )
local s
if usecaching then
local v0 = a*0x1000000 + b*0x10000 + c*0x100 + d
s = cache[v0]
if not s then
local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
cache[v0] = s
end
else
local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
end
t[k] = s
k = k + 1
end
if padding == 1 then
local a, b, c = b64:byte( n-3, n-1 )
local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40
t[k] = char( extract(v,16,8), extract(v,8,8))
elseif padding == 2 then
local a, b = b64:byte( n-3, n-2 )
local v = decoder[a]*0x40000 + decoder[b]*0x1000
t[k] = char( extract(v,16,8))
end
return concat( t )
decoder = decoder or DEFAULT_DECODER
local pattern = '[^%w%+%/%=]'
if decoder then
local s62, s63
for charcode, b64code in pairs( decoder ) do
if b64code == 62 then s62 = charcode
elseif b64code == 63 then s63 = charcode
end
end
pattern = ('[^%%w%%%s%%%s%%=]'):format( char(s62), char(s63) )
end
b64 = b64:gsub( pattern, '' )
local cache = usecaching and {}
local t, k = {}, 1
local n = #b64
local padding = b64:sub(-2) == '==' and 2 or b64:sub(-1) == '=' and 1 or 0
for i = 1, padding > 0 and n-4 or n, 4 do
local a, b, c, d = b64:byte( i, i+3 )
local s
if usecaching then
local v0 = a*0x1000000 + b*0x10000 + c*0x100 + d
s = cache[v0]
if not s then
local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
cache[v0] = s
end
else
local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
end
t[k] = s
k = k + 1
end
if padding == 1 then
local a, b, c = b64:byte( n-3, n-1 )
local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40
t[k] = char( extract(v,16,8), extract(v,8,8))
elseif padding == 2 then
local a, b = b64:byte( n-3, n-2 )
local v = decoder[a]*0x40000 + decoder[b]*0x1000
t[k] = char( extract(v,16,8))
end
return concat( t )
end
return base64
@ -198,4 +198,4 @@ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------
--]]
--]]

View file

@ -0,0 +1,2 @@
local entity_id = GetUpdatedEntityID()
EntityKill(entity_id)

View file

@ -0,0 +1,23 @@
local rpc = net.new_rpc_namespace()
local ghost = {}
function rpc.send_ghost_data(ghosts_memory)
for i, entity in ipairs(EntityGetAllChildren(ctx.rpc_player_data.entity, "angry_ghost") or {}) do
local memory = EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", "angry_ghost_projectile_memory")
ComponentSetValue2(memory, "value_string", ghosts_memory[i])
end
end
function ghost.on_world_update()
if GameGetFrameNum() % 10 ~= 6 then
return
end
local ghosts_memory = {}
for _, entity in ipairs(EntityGetAllChildren(ctx.my_player.entity, "angry_ghost") or {}) do
local memory = EntityGetFirstComponentIncludingDisabled(entity, "VariableStorageComponent", "angry_ghost_projectile_memory")
table.insert(ghosts_memory, ComponentGetValue2(memory, "value_string"))
end
rpc.send_ghost_data(ghosts_memory)
end
return ghost

View file

@ -141,6 +141,7 @@ local function get_sync_entities(return_all)
end)
table_extend(entities, EntityGetWithTag("ew_enemy_sync_extra"))
table_extend(entities, EntityGetWithTag("mimic_potion"))
table_extend(entities, EntityGetWithTag("plague_rat"))
table_extend_filtered(entities, EntityGetWithTag("prop_physics"), function (ent)
return constants.phys_sync_allowed[EntityGetFilename(ent)]
end)

View file

@ -0,0 +1,26 @@
local np = require("noitapatcher")
local rpc = net.new_rpc_namespace()
function rpc.spawn_gate()
local x, y = EntityGetTransform(ctx.my_player.entity)
for _, ent in ipairs(EntityGetInRadius(x, y, 1024) or {}) do
if EntityGetFilename(ent) == "data/entities/buildings/wizardcave_gate.xml" then
local x_orig, y_orig = EntityGetTransform( ent )
-- spawn monster spawner
EntityLoad("mods/quant.ew/files/system/gate_boss/wizardcave_gate_monster_spawner.xml", x_orig, y_orig)
-- audio
GamePlaySound( "data/audio/Desktop/projectiles.snd", "player_projectiles/crumbling_earth/create", x_orig, y_orig )
GameTriggerMusicFadeOutAndDequeueAll( 3.0 )
GameTriggerMusicEvent( "music/oneshot/04", true, x_orig, y_orig )
-- remove self
EntityKill(ent)
return
end
end
end
np.CrossCallAdd("ew_spawn_gate", function()
rpc.spawn_gate()
end)
return {}

View file

@ -0,0 +1,47 @@
<Entity>
<LoadEntitiesComponent
count.min="1"
count.max="1"
kill_entity="0"
entity_file="data/entities/particles/image_emitters/magical_symbol.xml" >
</LoadEntitiesComponent>
<LifetimeComponent
lifetime="240" >
</LifetimeComponent>
<!-- clear area -->
<CellEaterComponent
eat_probability="2"
radius="140"
ignored_material="rock_box2d_nohit_hard" >
</CellEaterComponent>
<ParticleEmitterComponent
emitted_material_name="spark_red"
gravity.y="0.0"
lifetime_min="0.4"
lifetime_max="1.2"
x_pos_offset_min="0"
x_pos_offset_max="0"
y_pos_offset_min="0"
y_pos_offset_max="0"
area_circle_radius.min="0"
area_circle_radius.max="150"
count_min="100"
count_max="100"
render_on_grid="1"
collide_with_grid="0"
fade_based_on_lifetime="1"
cosmetic_force_create="0"
airflow_force="0.251"
airflow_time="1.01"
airflow_scale="0.05"
emission_interval_min_frames="1"
emission_interval_max_frames="1"
emit_cosmetic_particles="1"
is_emitting="1" >
</ParticleEmitterComponent>
</Entity>

View file

@ -181,17 +181,14 @@ local function do_game_over(message)
GameRemoveFlagRun("ew_cam_wait")
ctx.my_player.entity = end_poly_effect(ctx.my_player.entity)
polymorph.switch_entity(ctx.my_player.entity)
async(function()
wait(1)
if ctx.my_player.entity ~= nil then
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", false)
EntityInflictDamage(ctx.my_player.entity, 1000000, "DAMAGE_CURSE", message, "NONE", 0, 0, GameGetWorldStateEntity())
GameTriggerGameOver()
EntityKill(ctx.my_player.entity)
else
GameTriggerGameOver()
end
end)
if ctx.my_player.entity ~= nil then
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", false)
EntityInflictDamage(ctx.my_player.entity, 1000000, "DAMAGE_CURSE", message, "NONE", 0, 0, GameGetWorldStateEntity())
GameTriggerGameOver()
EntityKill(ctx.my_player.entity)
else
GameTriggerGameOver()
end
else
GameSetCameraFree(true)
GameTriggerGameOver()

View file

@ -1106,7 +1106,7 @@ end
function module.on_world_update()
local active = GameHasFlagRun("ew_flag_notplayer_active")
if active then
if active and EntityGetIsAlive(ctx.my_player.entity) and EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
if state == nil then
init_state()
end

View file

@ -9,57 +9,57 @@ local projectiles = EntityGetInRadiusWithTag( x, y, radius, "homing_target" )
local projectiles2 = EntityGetInRadiusWithTag( x, y, radius, "summon_player" )
if ( #projectiles2 > 0 ) then
for i,v in ipairs( projectiles2 ) do
table.insert( projectiles, v )
end
for i,v in ipairs( projectiles2 ) do
table.insert( projectiles, v )
end
end
local count = 0
local who_shot
local comp = EntityGetFirstComponent( entity_id, "ProjectileComponent" )
if ( comp ~= nil ) then
who_shot = ComponentGetValue2( comp, "mWhoShot" )
who_shot = ComponentGetValue2( comp, "mWhoShot" )
end
if ( who_shot ~= nil ) and ( comp ~= nil ) then
for i,projectile_id in ipairs(projectiles) do
if ( projectile_id ~= root_id ) and ( projectile_id ~= entity_id ) and ( projectile_id ~= who_shot ) and ( EntityHasTag( projectile_id, "essence_to_power_target" ) == false ) then
local comp2 = EntityGetFirstComponent( projectile_id, "DamageModelComponent" )
if ( comp2 ~= nil ) then
local amount = ComponentGetValue2( comp2, "max_hp" ) or 0.1
count = count + math.max( 0.5, amount * 0.25 )
EntityAddTag( projectile_id, "essence_to_power_target" )
local eid = EntityLoad( "data/entities/misc/essence_to_power_cooldown.xml", x, y )
EntityAddChild( projectile_id, eid )
end
end
end
local damage = ComponentGetValue2( comp, "damage" )
local expdamage = ComponentObjectGetValue2( comp, "config_explosion", "damage" )
local exprad = ComponentObjectGetValue2( comp, "config_explosion", "explosion_radius" )
damage = damage + math.min( 120, count * 0.25 )
expdamage = expdamage + math.min( 120, count * 0.25 )
exprad = math.max( exprad, math.min( 120, math.floor( exprad + math.log( count * 5.5 ) ) ) )
-- print("FINAL: " .. tostring(count))
ComponentSetValue2( comp, "damage", damage )
ComponentObjectSetValue2( comp, "config_explosion", "damage", expdamage )
ComponentObjectSetValue2( comp, "config_explosion", "explosion_radius", exprad )
local effect_id = EntityLoad("data/entities/particles/tinyspark_blue_large.xml", x, y)
EntityAddChild( root_id, effect_id )
edit_component( effect_id, "ParticleEmitterComponent", function(comp3,vars)
local part_min = math.min( math.floor( count * 0.5 ), 100 )
local part_max = math.min( count + 1, 120 )
ComponentSetValue2( comp3, "count_min", part_min )
ComponentSetValue2( comp3, "count_max", part_max )
end)
for i,projectile_id in ipairs(projectiles) do
if ( projectile_id ~= root_id ) and ( projectile_id ~= entity_id ) and ( projectile_id ~= who_shot ) and ( EntityHasTag( projectile_id, "essence_to_power_target" ) == false ) then
local comp2 = EntityGetFirstComponent( projectile_id, "DamageModelComponent" )
if ( comp2 ~= nil ) then
local amount = ComponentGetValue2( comp2, "max_hp" ) or 0.1
count = count + math.max( 0.5, amount * 0.25 )
EntityAddTag( projectile_id, "essence_to_power_target" )
local eid = EntityLoad( "data/entities/misc/essence_to_power_cooldown.xml", x, y )
EntityAddChild( projectile_id, eid )
end
end
end
local damage = ComponentGetValue2( comp, "damage" )
local expdamage = ComponentObjectGetValue2( comp, "config_explosion", "damage" )
local exprad = ComponentObjectGetValue2( comp, "config_explosion", "explosion_radius" )
damage = damage + math.min( 120, count * 0.25 )
expdamage = expdamage + math.min( 120, count * 0.25 )
exprad = math.max( exprad, math.min( 120, math.floor( exprad + math.log( count * 5.5 ) ) ) )
-- print("FINAL: " .. tostring(count))
ComponentSetValue2( comp, "damage", damage )
ComponentObjectSetValue2( comp, "config_explosion", "damage", expdamage )
ComponentObjectSetValue2( comp, "config_explosion", "explosion_radius", exprad )
local effect_id = EntityLoad("data/entities/particles/tinyspark_blue_large.xml", x, y)
EntityAddChild( root_id, effect_id )
edit_component( effect_id, "ParticleEmitterComponent", function(comp3,vars)
local part_min = math.min( math.floor( count * 0.5 ), 100 )
local part_max = math.min( count + 1, 120 )
ComponentSetValue2( comp3, "count_min", part_min )
ComponentSetValue2( comp3, "count_max", part_max )
end)
end

View file

@ -11,77 +11,77 @@ local expcount = 0
local who_shot
local comp = EntityGetFirstComponent( entity_id, "ProjectileComponent" )
if ( comp ~= nil ) then
who_shot = ComponentGetValue2( comp, "mWhoShot" )
who_shot = ComponentGetValue2( comp, "mWhoShot" )
end
if ( who_shot ~= nil ) and ( comp ~= nil ) then
for i,projectile_id in ipairs(projectiles) do
if ( projectile_id ~= root_id ) and ( projectile_id ~= entity_id ) and ( EntityHasTag( projectile_id, "spells_to_power_target" ) == false ) and ( EntityHasTag( projectile_id, "projectile_not" ) == false ) then
local comp2 = EntityGetFirstComponent( projectile_id, "ProjectileComponent" )
local delete = false
if ( comp2 ~= nil ) then
local who_shot2 = ComponentGetValue2( comp2, "mWhoShot" )
if ( who_shot == who_shot2 ) and ( who_shot ~= NULL_ENTITY ) then
delete = true
ComponentSetValue2( comp2, "on_death_explode", false )
ComponentSetValue2( comp2, "on_lifetime_out_explode", false )
ComponentSetValue2( comp2, "collide_with_entities", false )
ComponentSetValue2( comp2, "collide_with_world", false )
ComponentSetValue2( comp2, "lifetime", 999 )
end
end
if delete then
local amount = ComponentGetValue2( comp2, "damage" ) or 0.1
local amount2 = tonumber( ComponentObjectGetValue2( comp2, "config_explosion", "damage" ) ) or 0.1
for i,projectile_id in ipairs(projectiles) do
if ( projectile_id ~= root_id ) and ( projectile_id ~= entity_id ) and ( EntityHasTag( projectile_id, "spells_to_power_target" ) == false ) and ( EntityHasTag( projectile_id, "projectile_not" ) == false ) then
local comp2 = EntityGetFirstComponent( projectile_id, "ProjectileComponent" )
local delete = false
amount = amount * 10
amount2 = amount2 * 10
count = count + amount
expcount = expcount + amount2
local px, py = EntityGetTransform( projectile_id )
EntityLoad("data/entities/particles/poof_red_tiny.xml", px, py)
if delete then
EntityAddComponent( projectile_id, "LifetimeComponent",
{
lifetime = "1",
} )
end
end
end
end
local totalcount = count + expcount
local damage = ComponentGetValue2( comp, "damage" )
local expdamage = ComponentObjectGetValue2( comp, "config_explosion", "damage" )
local exprad = ComponentObjectGetValue2( comp, "config_explosion", "explosion_radius" )
damage = damage + count * 0.1
expdamage = expdamage + expcount * 0.1
exprad = math.min( 120, math.floor( exprad + math.log( totalcount * 10.5 ) ) )
ComponentSetValue2( comp, "damage", damage )
ComponentObjectSetValue2( comp, "config_explosion", "damage", expdamage )
ComponentObjectSetValue2( comp, "config_explosion", "explosion_radius", exprad )
local effect_id = EntityLoad("data/entities/particles/tinyspark_red_large.xml", x, y)
EntityAddChild( root_id, effect_id )
edit_component( effect_id, "ParticleEmitterComponent", function(comp3,vars)
local part_min = math.min( math.floor( totalcount * 0.5 ), 100 )
local part_max = math.min( totalcount + 1, 120 )
if ( comp2 ~= nil ) then
local who_shot2 = ComponentGetValue2( comp2, "mWhoShot" )
-- NOTE( Petri ) 1.3.2023 - this fixes the crash. Thanks Letaali
if( part_min < 0 ) then part_min = 0 end
if( part_max < 0 ) then part_max = 0 end
if ( who_shot == who_shot2 ) and ( who_shot ~= NULL_ENTITY ) then
delete = true
ComponentSetValue2( comp2, "on_death_explode", false )
ComponentSetValue2( comp2, "on_lifetime_out_explode", false )
ComponentSetValue2( comp2, "collide_with_entities", false )
ComponentSetValue2( comp2, "collide_with_world", false )
ComponentSetValue2( comp2, "lifetime", 999 )
end
end
ComponentSetValue2( comp3, "count_min", part_min )
ComponentSetValue2( comp3, "count_max", part_max )
end)
if delete then
local amount = ComponentGetValue2( comp2, "damage" ) or 0.1
local amount2 = tonumber( ComponentObjectGetValue2( comp2, "config_explosion", "damage" ) ) or 0.1
amount = amount * 10
amount2 = amount2 * 10
count = count + amount
expcount = expcount + amount2
local px, py = EntityGetTransform( projectile_id )
EntityLoad("data/entities/particles/poof_red_tiny.xml", px, py)
if delete then
EntityAddComponent( projectile_id, "LifetimeComponent",
{
lifetime = "1",
} )
end
end
end
end
local totalcount = count + expcount
local damage = ComponentGetValue2( comp, "damage" )
local expdamage = ComponentObjectGetValue2( comp, "config_explosion", "damage" )
local exprad = ComponentObjectGetValue2( comp, "config_explosion", "explosion_radius" )
damage = damage + count * 0.1
expdamage = expdamage + expcount * 0.1
exprad = math.min( 120, math.floor( exprad + math.log( totalcount * 10.5 ) ) )
ComponentSetValue2( comp, "damage", damage )
ComponentObjectSetValue2( comp, "config_explosion", "damage", expdamage )
ComponentObjectSetValue2( comp, "config_explosion", "explosion_radius", exprad )
local effect_id = EntityLoad("data/entities/particles/tinyspark_red_large.xml", x, y)
EntityAddChild( root_id, effect_id )
edit_component( effect_id, "ParticleEmitterComponent", function(comp3,vars)
local part_min = math.min( math.floor( totalcount * 0.5 ), 100 )
local part_max = math.min( totalcount + 1, 120 )
-- NOTE( Petri ) 1.3.2023 - this fixes the crash. Thanks Letaali
if( part_min < 0 ) then part_min = 0 end
if( part_max < 0 ) then part_max = 0 end
ComponentSetValue2( comp3, "count_min", part_min )
ComponentSetValue2( comp3, "count_max", part_max )
end)
end

View file

@ -1,5 +1,5 @@
function temple_spawn_guardian( pos_x, pos_y )
if CrossCall("ew_is_host") then
if GameHasFlagRun("ew_flag_this_is_host") then
CrossCall("ew_spawn_stevari", pos_x, pos_y)
end
end

View file

@ -0,0 +1,65 @@
<Entity tags="necromancer_shop" serialize="1">
<LightComponent
_enabled="1"
radius="255"
fade_out_time="10.5"
r="130"
g="83"
b="222"
offset_y="-16"
>
</LightComponent>
<SpriteParticleEmitterComponent
sprite_file="data/particles/purple_whirl_0$[1-8].png"
sprite_centered="1"
delay="0"
lifetime="1.5"
color.r="1" color.g="1" color.b="1" color.a="0.75"
color_change.r="0" color_change.g="0" color_change.b="0" color_change.a="-0.8"
velocity.x="0" velocity.y="0"
gravity.x="0" gravity.y="0"
velocity_slowdown="0.35"
rotation="0"
angular_velocity="7.5"
render_back="1"
use_velocity_as_rotation="0"
scale.x="1.0" scale.y="1.0"
scale_velocity.x="1.0075" scale_velocity.y="1.0075"
emission_interval_min_frames="2"
emission_interval_max_frames="4"
count_min="1" count_max="1"
randomize_position.min_x="-0.5"
randomize_position.max_x="0.5"
randomize_position.min_y="-0.5"
randomize_position.max_y="0.5"
randomize_velocity.min_x="-5"
randomize_velocity.max_x="5"
randomize_velocity.min_y="-5"
randomize_velocity.max_y="5"
randomize_lifetime.min="-0.2"
randomize_lifetime.max="0.2"
randomize_angular_velocity.min="-3.5"
randomize_angular_velocity.max="3.5"
randomize_rotation.min="-90"
randomize_rotation.max="90"
>
</SpriteParticleEmitterComponent>
<LuaComponent
script_source_file="mods/quant.ew/files/resource/kill_root.lua"
execute_every_n_frame="180"
>
</LuaComponent>
<!--
<LoadEntitiesComponent
count.min="1"
count.max="1"
timeout_frames="180"
kill_entity="1"
entity_file="data/entities/animals/necromancer_shop.xml" >
</LoadEntitiesComponent>
-->
</Entity>

View file

@ -1,9 +1,6 @@
local rpc = net.new_rpc_namespace()
ModLuaFileAppend("data/scripts/biomes/temple_shared.lua", "mods/quant.ew/files/system/stevari/append.lua")
np.CrossCallAdd("ew_is_host", function()
return ctx.is_host
end)
rpc.opts_everywhere()
function rpc.spawn_stevari(pos_x, pos_y)
@ -21,9 +18,15 @@ function rpc.spawn_stevari(pos_x, pos_y)
EntityKill( guard_spawn_id )
end
EntityLoad( "data/entities/misc/spawn_necromancer_shop.xml", guard_x, guard_y )
if ctx.is_host then
EntityLoad( "data/entities/misc/spawn_necromancer_shop.xml", guard_x, guard_y )
else
EntityLoad( "mods/quant.ew/files/system/stevari/spawn_necromancer_shop.xml", guard_x, guard_y )
end
end
np.CrossCallAdd("ew_spawn_stevari", function(x, y)
rpc.spawn_stevari(x, y)
end)
end)
return {}

View file

@ -0,0 +1,54 @@
<Entity>
<LightComponent
_enabled="1"
radius="255"
fade_out_time="10.5"
r="10"
g="180"
b="222"
>
</LightComponent>
<SpriteParticleEmitterComponent
sprite_file="data/particles/whirl_0$[1-8].png"
sprite_centered="1"
delay="0"
lifetime="1.5"
color.r="1" color.g="1" color.b="1" color.a="0.75"
color_change.r="0" color_change.g="0" color_change.b="0" color_change.a="-0.8"
velocity.x="0" velocity.y="0"
gravity.x="0" gravity.y="0"
velocity_slowdown="0.35"
rotation="0"
angular_velocity="7.5"
render_back="1"
use_velocity_as_rotation="0"
scale.x="1.0" scale.y="1.0"
scale_velocity.x="1.0075" scale_velocity.y="1.0075"
emission_interval_min_frames="2"
emission_interval_max_frames="4"
count_min="1" count_max="1"
randomize_position.min_x="-0.5"
randomize_position.max_x="0.5"
randomize_position.min_y="-0.5"
randomize_position.max_y="0.5"
randomize_velocity.min_x="-5"
randomize_velocity.max_x="5"
randomize_velocity.min_y="-5"
randomize_velocity.max_y="5"
randomize_lifetime.min="-0.2"
randomize_lifetime.max="0.2"
randomize_angular_velocity.min="-3.5"
randomize_angular_velocity.max="3.5"
randomize_rotation.min="-90"
randomize_rotation.max="90"
>
</SpriteParticleEmitterComponent>
<LuaComponent
script_source_file="mods/quant.ew/files/resource/kill_root.lua"
execute_every_n_frame="180"
>
</LuaComponent>
</Entity>

View file

@ -0,0 +1,15 @@
local rpc = net.new_rpc_namespace()
local tapion = {}
function rpc.set_helpless(anger)
GlobalsSetValue( "HELPLESS_KILLS", tostring(anger) )
end
function tapion.on_world_update()
if GameGetFrameNum() % 60 == 57 then
rpc.set_helpless(tonumber(GlobalsGetValue( "HELPLESS_KILLS", "1" )))
end
end
return tapion

View file

@ -21,21 +21,22 @@ function worms.on_world_update()
if GameGetFrameNum() % 10 ~= 0 then
return
end
for _, ent in ipairs(EntityGetWithTag("boss_dragon") or {}) do
for _, ent in ipairs(EntityGetWithTag("enemy") or {}) do
local dragon = EntityGetFirstComponentIncludingDisabled(ent, "BossDragonComponent")
local x, y = EntityGetTransform(ent)
local min_ent = get_closest_alive(x, y)
if min_ent ~= nil then
ComponentSetValue2(dragon, "mTargetEntityId", min_ent)
end
end
for _, ent in ipairs(EntityGetWithTag("worm") or {}) do
local worm = EntityGetFirstComponentIncludingDisabled(ent, "WormAIComponent")
if EntityHasTag(ComponentGetValue2(worm, "mTargetEntityId"), "ew_notplayer") then
if dragon ~= nil then
local x, y = EntityGetTransform(ent)
local min_ent = get_closest_alive(x, y)
if min_ent ~= nil then
ComponentSetValue2(worm, "mTargetEntityId", min_ent)
ComponentSetValue2(dragon, "mTargetEntityId", min_ent)
end
else
local worm = EntityGetFirstComponentIncludingDisabled(ent, "WormAIComponent")
if worm ~= nil and EntityHasTag(ComponentGetValue2(worm, "mTargetEntityId"), "ew_notplayer") then
local x, y = EntityGetTransform(ent)
local min_ent = get_closest_alive(x, y)
if min_ent ~= nil then
ComponentSetValue2(worm, "mTargetEntityId", min_ent)
end
end
end
end

View file

@ -118,6 +118,9 @@ local function load_modules()
ctx.load_system("worms")
ctx.load_system("wand_charm")
ctx.load_system("stevari")
ctx.load_system("angry_ghost_memory")
ctx.load_system("gate_boss")
ctx.load_system("tapion")
end
local function load_extra_modules()
@ -189,7 +192,7 @@ function OnPausedChanged(paused, is_wand_pickup)
--EntitySetComponentIsEnabled(players[1], inventory_gui, false)
np.EnableInventoryGuiUpdate(false)
np.EnablePlayerItemPickUpper(false)
ComponentSetValue2(controls_component, "enabled", false)
ComponentSetValue2(controls_component, "enabled", true)
else
--EntitySetComponentIsEnabled(players[1], inventory_gui, true)
np.EnableInventoryGuiUpdate(true)