use spaces instead of tabs for consistency

This commit is contained in:
bgkillas 2024-10-05 10:54:55 -04:00
parent 43be6c3a50
commit 8c7f581d3e
42 changed files with 3867 additions and 3871 deletions

View file

@ -1,4 +1,4 @@
<Mod
version_built_with="12"
>
</Mod>
version_built_with="12"
>
</Mod>

View file

@ -6,16 +6,16 @@ local x,y = EntityGetTransform( boss_id )
local comp = EntityGetFirstComponent( entity_id, "VariableStorageComponent", "wizard_orb_id" )
if ( comp ~= nil ) then
local id = ComponentGetValue2( comp, "value_int" )
local id = ComponentGetValue2( comp, "value_int" )
local count = 8
local circle = math.pi * 2
local inc = circle / count
local count = 8
local circle = math.pi * 2
local inc = circle / count
local dir = inc * id + CrossCall("ew_host_frame_num") * 0.01
local dir = inc * id + CrossCall("ew_host_frame_num") * 0.01
local nx = x + math.cos( dir ) * 50
local ny = y - math.sin( dir ) * 50 - 20
local nx = x + math.cos( dir ) * 50
local ny = y - math.sin( dir ) * 50 - 20
EntitySetTransform( entity_id, nx, ny )
EntitySetTransform( entity_id, nx, ny )
end

View file

@ -1,35 +1,35 @@
<Entity name="unknown" >
<PhysicsBodyComponent
uid="1"
allow_sleep="1"
angular_damping="0"
fixed_rotation="0"
is_bullet="0"
<PhysicsBodyComponent
uid="1"
allow_sleep="1"
angular_damping="0"
fixed_rotation="0"
is_bullet="0"
linear_damping="0"
auto_clean="0"
on_death_leave_physics_body="1" >
</PhysicsBodyComponent>
<PhysicsImageShapeComponent
<PhysicsImageShapeComponent
body_id="1"
centered="1"
image_file="data/props_gfx/minecart.png"
material="metal_rust" >
</PhysicsImageShapeComponent>
<PhysicsBodyComponent
uid="2"
allow_sleep="1"
angular_damping="0.1"
fixed_rotation="0"
is_bullet="0"
<PhysicsBodyComponent
uid="2"
allow_sleep="1"
angular_damping="0.1"
fixed_rotation="0"
is_bullet="0"
linear_damping="0"
auto_clean="0"
auto_clean="0"
update_entity_transform="0"
on_death_leave_physics_body="1"
>
</PhysicsBodyComponent>
<PhysicsImageShapeComponent
<PhysicsImageShapeComponent
body_id="2"
centered="1"
is_circle="1"
@ -38,19 +38,19 @@
material="metal_rust" >
</PhysicsImageShapeComponent>
<PhysicsBodyComponent
uid="3"
allow_sleep="1"
angular_damping="0.1"
fixed_rotation="0"
is_bullet="0"
<PhysicsBodyComponent
uid="3"
allow_sleep="1"
angular_damping="0.1"
fixed_rotation="0"
is_bullet="0"
linear_damping="0"
auto_clean="0"
auto_clean="0"
update_entity_transform="0"
on_death_leave_physics_body="1"
>
</PhysicsBodyComponent>
<PhysicsImageShapeComponent
<PhysicsImageShapeComponent
body_id="3"
centered="1"
is_circle="1"
@ -59,24 +59,24 @@
material="metal_rust" >
</PhysicsImageShapeComponent>
<PhysicsJointComponent
<PhysicsJointComponent
body1_id="1"
body2_id="2"
pos_x="4"
pos_y="12"
>
body2_id="2"
pos_x="4"
pos_y="12"
>
</PhysicsJointComponent>
<PhysicsJointComponent
<PhysicsJointComponent
body1_id="1"
body2_id="3"
pos_x="13"
pos_y="12"
>
body2_id="3"
pos_x="13"
pos_y="12"
>
</PhysicsJointComponent>
<CameraBoundComponent
max_count="50"
distance="500">
</CameraBoundComponent>
</Entity>
</Entity>

View file

@ -12,17 +12,17 @@ local pos_x, pos_y = EntityGetFirstHitboxCenter( entity_id )
local enemy, enemy_x, enemy_y
local min_dist = 9999
for _,id in pairs(EntityGetInRadiusWithTag(pos_x, pos_y, range, "mortal")) do
-- is target a valid enemy
if EntityGetComponent(id, "GenomeDataComponent") ~= nil and EntityGetComponent(root_id, "GenomeDataComponent") ~= nil and EntityGetHerdRelation(root_id, id) < 40 then
local x, y = EntityGetFirstHitboxCenter( id )
local dist = get_distance(pos_x, pos_y, x, y)
if dist < min_dist then
min_dist = dist
enemy = id
enemy_x = x
enemy_y = y
end
end
-- is target a valid enemy
if EntityGetComponent(id, "GenomeDataComponent") ~= nil and EntityGetComponent(root_id, "GenomeDataComponent") ~= nil and EntityGetHerdRelation(root_id, id) < 40 then
local x, y = EntityGetFirstHitboxCenter( id )
local dist = get_distance(pos_x, pos_y, x, y)
if dist < min_dist then
min_dist = dist
enemy = id
enemy_x = x
enemy_y = y
end
end
end
-- check los
@ -31,29 +31,29 @@ if enemy then can_shoot = not RaytraceSurfacesAndLiquiform(pos_x, pos_y, enemy_x
-- hand/shooting state & animation control
edit_component2( entity_id, "SpriteComponent", function(comp,vars)
-- if enemy is not visible then open hand
local hand_check = ComponentGetValue2( comp, "rect_animation" )
local hand_open = false
-- if enemy is not visible then open hand
local hand_check = ComponentGetValue2( comp, "rect_animation" )
local hand_open = false
if ( hand_check ~= nil ) and ( hand_check == "open" ) then
hand_open = true
end
if ( hand_check ~= nil ) and ( hand_check == "open" ) then
hand_open = true
end
if not can_shoot then
if not hand_open then
ComponentSetValue2( comp, "rect_animation", "open")
--EntitySetComponentsWithTagEnabled( entity_id, "enabled_when_attacking", false )
end
return
end
if not can_shoot then
if not hand_open then
ComponentSetValue2( comp, "rect_animation", "open")
--EntitySetComponentsWithTagEnabled( entity_id, "enabled_when_attacking", false )
end
return
end
-- prepare to shoot
if hand_open then
ComponentSetValue2( comp, "rect_animation", "close")
--EntitySetComponentsWithTagEnabled( entity_id, "enabled_when_attacking", true )
can_shoot = false
return
end
-- prepare to shoot
if hand_open then
ComponentSetValue2( comp, "rect_animation", "close")
--EntitySetComponentsWithTagEnabled( entity_id, "enabled_when_attacking", true )
can_shoot = false
return
end
end)
if not can_shoot then return end

View file

@ -2,53 +2,53 @@ dofile_once("data/scripts/lib/utilities.lua")
dofile_once("data/scripts/biomes/temple_shared.lua" )
function collision_trigger()
local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id )
local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id )
-- this reset the biome stats - see workshop_trigger_check_stats.lua
StatsBiomeReset()
-- this reset the biome stats - see workshop_trigger_check_stats.lua
StatsBiomeReset()
EntityLoad("data/entities/particles/image_emitters/magical_symbol.xml", pos_x - 144, pos_y + 82 - 12 )
--EntityLoad("data/entities/misc/workshop_collapse.xml", pos_x-144, pos_y+82)
--EntityLoad("data/entities/misc/workshop_areadamage.xml", pos_x-143, pos_y+47)
--EntityLoad("data/entities/misc/workshop_areadamage.xml", pos_x-543, pos_y+47)
EntityLoad("data/entities/particles/image_emitters/magical_symbol.xml", pos_x - 144, pos_y + 82 - 12 )
--EntityLoad("data/entities/misc/workshop_collapse.xml", pos_x-144, pos_y+82)
--EntityLoad("data/entities/misc/workshop_areadamage.xml", pos_x-143, pos_y+47)
--EntityLoad("data/entities/misc/workshop_areadamage.xml", pos_x-543, pos_y+47)
-- Destroy workshop entities
-- Destroy workshop entities
local workshop_1 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_1 );
--print("Destroyed workshop entity 2")
local workshop_1 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_1 );
--print("Destroyed workshop entity 2")
local workshop_2 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2 );
--print("Destroyed workshop entity 2")
local workshop_2 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2 );
--print("Destroyed workshop entity 2")
local workshop_2b = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2b );
--print("Destroyed workshop entity 2b")
local workshop_2b = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2b );
--print("Destroyed workshop entity 2b")
local workshop_3 = EntityGetClosestWithTag( pos_x, pos_y, "workshop_show_hint" )
EntityKill( workshop_3 );
--print("Destroyed workshop hint entity")
local workshop_3 = EntityGetClosestWithTag( pos_x, pos_y, "workshop_show_hint" )
EntityKill( workshop_3 );
--print("Destroyed workshop hint entity")
-- kill temple_areacheckers that are on (about) the same horizontal level as we are
local temple_areacheckers = EntityGetInRadiusWithTag( pos_x, pos_y, 2048, "temple_areachecker" )
for k,areachecker in pairs(temple_areacheckers) do
-- kill temple_areacheckers that are on (about) the same horizontal level as we are
local temple_areacheckers = EntityGetInRadiusWithTag( pos_x, pos_y, 2048, "temple_areachecker" )
for k,areachecker in pairs(temple_areacheckers) do
local area_x, area_y = EntityGetTransform( areachecker )
if( math.abs( pos_y - area_y ) < 512 ) then
EntityKill( areachecker )
end
end
local area_x, area_y = EntityGetTransform( areachecker )
if( math.abs( pos_y - area_y ) < 512 ) then
EntityKill( areachecker )
end
end
-- SetGlobalValue( "temple_collapsed_" )
-- tags="temple_areachecker"
-- SetGlobalValue( "temple_collapsed_" )
-- tags="temple_areachecker"
local collapse_name = "TEMPLE_COLLAPSED_" .. temple_pos_to_id( pos_x, pos_y )
GlobalsSetValue( collapse_name, "1" )
local collapse_name = "TEMPLE_COLLAPSED_" .. temple_pos_to_id( pos_x, pos_y )
GlobalsSetValue( collapse_name, "1" )
temple_set_active_flag( pos_x, pos_y, "0" )
temple_set_active_flag( pos_x, pos_y, "0" )
GameTriggerMusicFadeOutAndDequeueAll( 2.0 )
GamePlaySound( "data/audio/Desktop/misc.bank", "misc/temple_collapse", pos_x-112, pos_y + 40 )
GameTriggerMusicFadeOutAndDequeueAll( 2.0 )
GamePlaySound( "data/audio/Desktop/misc.bank", "misc/temple_collapse", pos_x-112, pos_y + 40 )
end

View file

@ -2,49 +2,49 @@ dofile_once("data/scripts/lib/utilities.lua")
dofile_once("data/scripts/biomes/temple_shared.lua" )
function collision_trigger()
local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id )
local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id )
-- this reset the biome stats - see workshop_trigger_check_stats.lua
StatsBiomeReset()
-- this reset the biome stats - see workshop_trigger_check_stats.lua
StatsBiomeReset()
EntityLoad("data/entities/particles/image_emitters/magical_symbol.xml", pos_x - 112, pos_y + 2 - 12 )
-- EntityLoad("data/entities/misc/workshop_collapse.xml", pos_x-112, pos_y+2)
-- EntityLoad("data/entities/misc/workshop_areadamage.xml", pos_x-111, pos_y-33)
-- EntityLoad("data/entities/misc/workshop_areadamage.xml", pos_x-511, pos_y-33)
EntityLoad("data/entities/particles/image_emitters/magical_symbol.xml", pos_x - 112, pos_y + 2 - 12 )
-- EntityLoad("data/entities/misc/workshop_collapse.xml", pos_x-112, pos_y+2)
-- EntityLoad("data/entities/misc/workshop_areadamage.xml", pos_x-111, pos_y-33)
-- EntityLoad("data/entities/misc/workshop_areadamage.xml", pos_x-511, pos_y-33)
-- Destroy workshop entities
-- Destroy workshop entities
local workshop_1 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_1 );
--print("Destroyed workshop entity 2")
local workshop_1 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_1 );
--print("Destroyed workshop entity 2")
local workshop_2 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2 );
--print("Destroyed workshop entity 2")
local workshop_2 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2 );
--print("Destroyed workshop entity 2")
local workshop_2b = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2b );
--print("Destroyed workshop entity 2b")
local workshop_2b = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2b );
--print("Destroyed workshop entity 2b")
local workshop_3 = EntityGetClosestWithTag( pos_x, pos_y, "workshop_show_hint" )
EntityKill( workshop_3 );
--print("Destroyed workshop hint entity")
local workshop_3 = EntityGetClosestWithTag( pos_x, pos_y, "workshop_show_hint" )
EntityKill( workshop_3 );
--print("Destroyed workshop hint entity")
-- kill temple_areacheckers that are on (about) the same horizontal level as we are
local temple_areacheckers = EntityGetInRadiusWithTag( pos_x, pos_y, 2048, "temple_areachecker" )
for k,areachecker in pairs(temple_areacheckers) do
local area_x, area_y = EntityGetTransform( areachecker )
if( math.abs( pos_y - area_y ) < 512 ) then
EntityKill( areachecker )
end
end
-- kill temple_areacheckers that are on (about) the same horizontal level as we are
local temple_areacheckers = EntityGetInRadiusWithTag( pos_x, pos_y, 2048, "temple_areachecker" )
for k,areachecker in pairs(temple_areacheckers) do
local area_x, area_y = EntityGetTransform( areachecker )
if( math.abs( pos_y - area_y ) < 512 ) then
EntityKill( areachecker )
end
end
GameTriggerMusicFadeOutAndDequeueAll( 2.0 )
GamePlaySound( "data/audio/Desktop/misc.bank", "misc/temple_collapse", pos_x-100, pos_y-50 )
GameTriggerMusicFadeOutAndDequeueAll( 2.0 )
GamePlaySound( "data/audio/Desktop/misc.bank", "misc/temple_collapse", pos_x-100, pos_y-50 )
temple_set_active_flag( pos_x, pos_y, "0" )
GlobalsSetValue( "FINAL_BOSS_ARENA_ENTERED", "1" )
temple_set_active_flag( pos_x, pos_y, "0" )
GlobalsSetValue( "FINAL_BOSS_ARENA_ENTERED", "1" )
EntityKill( entity_id )
EntityKill( entity_id )
end

View file

@ -2,30 +2,30 @@ dofile_once("data/scripts/lib/utilities.lua")
dofile_once("data/scripts/gun/procedural/gun_action_utils.lua")
function get_random_from( target )
local rnd = Random(1, #target)
local rnd = Random(1, #target)
return tostring(target[rnd])
return tostring(target[rnd])
end
function get_multiple_random_from( target, amount_ )
local amount = amount_ or 1
local amount = amount_ or 1
local result = {}
local result = {}
for i=1,amount do
local rnd = Random(1, #target)
for i=1,amount do
local rnd = Random(1, #target)
table.insert(result, tostring(target[rnd]))
end
table.insert(result, tostring(target[rnd]))
end
return result
return result
end
function get_random_between_range( target )
local minval = target[1]
local maxval = target[2]
local minval = target[1]
local maxval = target[2]
return Random(minval, maxval)
return Random(minval, maxval)
end
local entity_id = GetUpdatedEntityID()
@ -71,13 +71,13 @@ local gun_action = "BOMB"
local n_of_deaths = tonumber( StatsGlobalGetValue("death_count") )
if( n_of_deaths >= 1 ) then
if( Random(1,100) < 50 ) then
gun_action = get_random_from( gun.actions )
end
if( Random(1,100) < 50 ) then
gun_action = get_random_from( gun.actions )
end
end
for i=1,action_count do
--AddGunActionPermanent( entity_id, gun_action )
AddGunAction( entity_id, gun_action )
--AddGunActionPermanent( entity_id, gun_action )
AddGunAction( entity_id, gun_action )
end

View file

@ -2,30 +2,30 @@ dofile_once("data/scripts/lib/utilities.lua")
dofile_once("data/scripts/gun/procedural/gun_action_utils.lua")
function get_random_from( target )
local rnd = Random(1, #target)
local rnd = Random(1, #target)
return tostring(target[rnd])
return tostring(target[rnd])
end
function get_multiple_random_from( target, amount_ )
local amount = amount_ or 1
local amount = amount_ or 1
local result = {}
local result = {}
for i=1,amount do
local rnd = Random(1, #target)
for i=1,amount do
local rnd = Random(1, #target)
table.insert(result, tostring(target[rnd]))
end
table.insert(result, tostring(target[rnd]))
end
return result
return result
end
function get_random_between_range( target )
local minval = target[1]
local maxval = target[2]
local minval = target[1]
local maxval = target[2]
return Random(minval, maxval)
return Random(minval, maxval)
end
local entity_id = GetUpdatedEntityID()
@ -69,6 +69,6 @@ local action_count = 1
local gun_action = get_random_from( gun.actions )
for i=1,action_count do
--AddGunActionPermanent( entity_id, gun_action )
AddGunAction( entity_id, gun_action )
--AddGunActionPermanent( entity_id, gun_action )
AddGunAction( entity_id, gun_action )
end

View file

@ -2,30 +2,30 @@ dofile_once("data/scripts/lib/utilities.lua")
dofile_once("data/scripts/gun/procedural/gun_action_utils.lua")
function get_random_from( target )
local rnd = Random(1, #target)
local rnd = Random(1, #target)
return tostring(target[rnd])
return tostring(target[rnd])
end
function get_multiple_random_from( target, amount_ )
local amount = amount_ or 1
local amount = amount_ or 1
local result = {}
local result = {}
for i=1,amount do
local rnd = Random(1, #target)
for i=1,amount do
local rnd = Random(1, #target)
table.insert(result, tostring(target[rnd]))
end
table.insert(result, tostring(target[rnd]))
end
return result
return result
end
function get_random_between_range( target )
local minval = target[1]
local maxval = target[2]
local minval = target[1]
local maxval = target[2]
return Random(minval, maxval)
return Random(minval, maxval)
end
local entity_id = GetUpdatedEntityID()
@ -72,13 +72,13 @@ local gun_action = "LIGHT_BULLET"
local n_of_deaths = tonumber( StatsGlobalGetValue("death_count") )
if( n_of_deaths >= 1 ) then
if( Random(1,100) < 50 ) then
gun_action = get_random_from( gun.actions )
end
if( Random(1,100) < 50 ) then
gun_action = get_random_from( gun.actions )
end
end
for i=1,action_count do
--AddGunActionPermanent( entity_id, gun_action )
AddGunAction( entity_id, gun_action )
--AddGunActionPermanent( entity_id, gun_action )
AddGunAction( entity_id, gun_action )
end

View file

@ -2,30 +2,30 @@ dofile_once("data/scripts/lib/utilities.lua")
dofile_once("data/scripts/gun/procedural/gun_action_utils.lua")
function get_random_from( target )
local rnd = Random(1, #target)
local rnd = Random(1, #target)
return tostring(target[rnd])
return tostring(target[rnd])
end
function get_multiple_random_from( target, amount_ )
local amount = amount_ or 1
local amount = amount_ or 1
local result = {}
local result = {}
for i=1,amount do
local rnd = Random(1, #target)
for i=1,amount do
local rnd = Random(1, #target)
table.insert(result, tostring(target[rnd]))
end
table.insert(result, tostring(target[rnd]))
end
return result
return result
end
function get_random_between_range( target )
local minval = target[1]
local maxval = target[2]
local minval = target[1]
local maxval = target[2]
return Random(minval, maxval)
return Random(minval, maxval)
end
local entity_id = GetUpdatedEntityID()
@ -70,6 +70,6 @@ local action_count = math.min(Random(1,3), tonumber(deck_capacity))
local gun_action = get_random_from( gun.actions )
for i=1,action_count do
--AddGunActionPermanent( entity_id, gun_action )
AddGunAction( entity_id, gun_action )
--AddGunActionPermanent( entity_id, gun_action )
AddGunAction( entity_id, gun_action )
end

View file

@ -1,64 +1,64 @@
dofile_once("data/scripts/lib/utilities.lua")
function wand_fired( wand_id )
local projectile_velocity = 600
local projectile_velocity = 600
local entity_id = GetUpdatedEntityID()
local children = EntityGetAllChildren( entity_id )
local ghost_ids = {}
local root = EntityGetRootEntity(entity_id)
local shooter
if EntityHasTag(root, "ew_peer") and not EntityHasTag(root, "ew_notplayer") then
shooter = EntityGetWithTag("player_unit")[1]
else
shooter = root
end
local entity_id = GetUpdatedEntityID()
local children = EntityGetAllChildren( entity_id )
local ghost_ids = {}
local root = EntityGetRootEntity(entity_id)
local shooter
if EntityHasTag(root, "ew_peer") and not EntityHasTag(root, "ew_notplayer") then
shooter = EntityGetWithTag("player_unit")[1]
else
shooter = root
end
if ( children ~= nil ) then
for i,v in ipairs( children ) do
if EntityHasTag( v, "angry_ghost" ) then
table.insert( ghost_ids, v )
end
end
end
if ( children ~= nil ) then
for i,v in ipairs( children ) do
if EntityHasTag( v, "angry_ghost" ) then
table.insert( ghost_ids, v )
end
end
end
if ( wand_id ~= nil ) and ( wand_id ~= NULL_ENTITY ) then
for a,ghost_id in ipairs( ghost_ids ) do
local pos_x, pos_y = EntityGetTransform( ghost_id )
local comp_cd = EntityGetFirstComponent( ghost_id, "VariableStorageComponent", "angry_ghost_cooldown" )
if ( wand_id ~= nil ) and ( wand_id ~= NULL_ENTITY ) then
for a,ghost_id in ipairs( ghost_ids ) do
local pos_x, pos_y = EntityGetTransform( ghost_id )
local comp_cd = EntityGetFirstComponent( ghost_id, "VariableStorageComponent", "angry_ghost_cooldown" )
if ( comp_cd ~= nil ) then
local cd = ComponentGetValue2( comp_cd, "value_int" )
if ( comp_cd ~= nil ) then
local cd = ComponentGetValue2( comp_cd, "value_int" )
if ( cd == 0 ) then
SetRandomSeed(pos_x + GameGetFrameNum(), pos_y)
projectile_velocity = Random( 550, 750 )
if ( cd == 0 ) then
SetRandomSeed(pos_x + GameGetFrameNum(), pos_y)
projectile_velocity = Random( 550, 750 )
local x,y,dir = EntityGetTransform( wand_id )
local comp = EntityGetFirstComponent( ghost_id, "VariableStorageComponent", "angry_ghost_projectile_memory" )
local projectile = "data/entities/projectiles/deck/light_bullet.xml"
local x,y,dir = EntityGetTransform( wand_id )
local comp = EntityGetFirstComponent( ghost_id, "VariableStorageComponent", "angry_ghost_projectile_memory" )
local projectile = "data/entities/projectiles/deck/light_bullet.xml"
if ( comp ~= nil ) then
projectile = ComponentGetValue2( comp, "value_string" )
end
if ( comp ~= nil ) then
projectile = ComponentGetValue2( comp, "value_string" )
end
if ( #projectile == 0 ) then
projectile = "data/entities/projectiles/deck/light_bullet.xml"
end
if ( #projectile == 0 ) then
projectile = "data/entities/projectiles/deck/light_bullet.xml"
end
-- print( projectile )
-- print( projectile )
if ( #projectile > 0 ) then
local vel_x = math.cos( 0 - dir ) * projectile_velocity
local vel_y = 0 - math.sin( 0 - dir ) * projectile_velocity
shoot_projectile( shooter, projectile, pos_x, pos_y, vel_x, vel_y)
if ( #projectile > 0 ) then
local vel_x = math.cos( 0 - dir ) * projectile_velocity
local vel_y = 0 - math.sin( 0 - dir ) * projectile_velocity
shoot_projectile( shooter, projectile, pos_x, pos_y, vel_x, vel_y)
cd = 4
end
end
cd = 4
end
end
ComponentSetValue2( comp_cd, "value_int", cd )
end
end
end
ComponentSetValue2( comp_cd, "value_int", cd )
end
end
end
end

View file

@ -2,7 +2,7 @@ dofile_once("data/scripts/lib/utilities.lua")
local entity_id = GetUpdatedEntityID()
if not EntityGetIsAlive(entity_id) then
return
return
end
local x, y = EntityGetTransform( entity_id )
local px, py = x, y
@ -16,67 +16,67 @@ local memorycomp
local swaying = true
if ( comps ~= nil ) then
for i,v in ipairs( comps ) do
local name = ComponentGetValue2( v, "name" )
for i,v in ipairs( comps ) do
local name = ComponentGetValue2( v, "name" )
if ( name == "memory" ) then
memorycomp = v
target = ComponentGetValue2( v, "value_int" )
local test = EntityGetTransform( target )
if ( name == "memory" ) then
memorycomp = v
target = ComponentGetValue2( v, "value_int" )
local test = EntityGetTransform( target )
if ( test == nil ) then
target = 0
end
elseif ( name == "owner_id" ) then
owner_id = ComponentGetValue2( v, "value_int" )
px,py = EntityGetTransform( owner_id )
if ( test == nil ) then
target = 0
end
elseif ( name == "owner_id" ) then
owner_id = ComponentGetValue2( v, "value_int" )
px,py = EntityGetTransform( owner_id )
if ( px == nil ) or ( py == nil ) then
px,py = x,y
end
end
end
if ( px == nil ) or ( py == nil ) then
px,py = x,y
end
end
end
end
local cvx, cvy = 0, 0
local physcomp = EntityGetFirstComponent( entity_id, "PhysicsBodyComponent" )
if ( physcomp ~= nil ) then
cvx,cvy = PhysicsGetComponentVelocity( entity_id, physcomp )
cvx,cvy = PhysicsGetComponentVelocity( entity_id, physcomp )
end
if ( #targets > 0 ) and ( #targets2 == 0 ) and ( target == 0 ) then
SetRandomSeed( x + entity_id, px + py )
local rnd = Random( 1, #targets )
SetRandomSeed( x + entity_id, px + py )
local rnd = Random( 1, #targets )
target = targets[rnd]
target = targets[rnd]
if ( memorycomp ~= nil ) then
ComponentSetValue2( memorycomp, "value_int", target )
end
if ( memorycomp ~= nil ) then
ComponentSetValue2( memorycomp, "value_int", target )
end
end
if ( #targets2 > 0 ) then
SetRandomSeed( x + entity_id, px + py )
local rnd = Random( 1, #targets2 )
SetRandomSeed( x + entity_id, px + py )
local rnd = Random( 1, #targets2 )
target = targets2[rnd]
swaying = false
target = targets2[rnd]
swaying = false
end
if ( target ~= 0 ) then
local test = EntityGetTransform( target )
local test = EntityGetTransform( target )
if ( test ~= nil ) then
px, py = EntityGetFirstHitboxCenter( target )
end
if ( test ~= nil ) then
px, py = EntityGetFirstHitboxCenter( target )
end
end
if swaying then
local arc = GameGetFrameNum() * 0.01 + entity_id
local length = 12
local arc = GameGetFrameNum() * 0.01 + entity_id
local length = 12
px = px + math.cos( arc ) * length + math.sin( 0 - arc ) * length
py = py - math.sin( arc ) * length - math.cos( 0 - arc ) * length
px = px + math.cos( arc ) * length + math.sin( 0 - arc ) * length
py = py - math.sin( arc ) * length - math.cos( 0 - arc ) * length
end
local dir = get_direction( x, y, px, py )
@ -86,27 +86,27 @@ local vel_x = 0 - (math.cos( dir ) * dist)
local vel_y = 0 - (0 - math.sin( dir ) * dist)
if ( ( x > px ) and ( cvx > 0 ) ) or ( ( x < px ) and ( cvx < 0 ) ) then
vel_x = vel_x * 4
vel_x = vel_x * 4
end
if ( ( y > py ) and ( cvy > 0 ) ) or ( ( y < py ) and ( cvy < 0 ) ) then
vel_y = vel_y * 4
vel_y = vel_y * 4
end
PhysicsApplyForce( entity_id, vel_x, vel_y )
if ( owner_id ~= 0 ) then
x, y = EntityGetTransform( entity_id )
local ox, oy = EntityGetTransform( owner_id )
if ox == nil then
return
end
dist = math.abs( x - ox ) + math.abs( y - oy )
x, y = EntityGetTransform( entity_id )
local ox, oy = EntityGetTransform( owner_id )
if ox == nil then
return
end
dist = math.abs( x - ox ) + math.abs( y - oy )
if ( dist > 900 ) then
EntityLoad( "data/entities/particles/teleportation_source.xml", x, y )
EntityLoad( "data/entities/particles/teleportation_target.xml", ox, oy )
EntitySetTransform( entity_id, ox, oy )
EntityApplyTransform( entity_id, ox, oy )
end
if ( dist > 900 ) then
EntityLoad( "data/entities/particles/teleportation_source.xml", x, y )
EntityLoad( "data/entities/particles/teleportation_target.xml", ox, oy )
EntitySetTransform( entity_id, ox, oy )
EntityApplyTransform( entity_id, ox, oy )
end
end

View file

@ -218,8 +218,8 @@ end
-- Returns true if entity is a wand
local function entity_is_wand(entity_id)
local ability_component = EntityGetFirstComponentIncludingDisabled(entity_id, "AbilityComponent")
return ComponentGetValue2(ability_component, "use_gun_script") == true
local ability_component = EntityGetFirstComponentIncludingDisabled(entity_id, "AbilityComponent")
return ComponentGetValue2(ability_component, "use_gun_script") == true
end
local function starts_with(str, start)
@ -333,18 +333,18 @@ end
local spell_type_bgs = {
[ACTION_TYPE_PROJECTILE] = "data/ui_gfx/inventory/item_bg_projectile.png",
[ACTION_TYPE_STATIC_PROJECTILE] = "data/ui_gfx/inventory/item_bg_static_projectile.png",
[ACTION_TYPE_MODIFIER] = "data/ui_gfx/inventory/item_bg_modifier.png",
[ACTION_TYPE_DRAW_MANY] = "data/ui_gfx/inventory/item_bg_draw_many.png",
[ACTION_TYPE_MATERIAL] = "data/ui_gfx/inventory/item_bg_material.png",
[ACTION_TYPE_OTHER] = "data/ui_gfx/inventory/item_bg_other.png",
[ACTION_TYPE_UTILITY] = "data/ui_gfx/inventory/item_bg_utility.png",
[ACTION_TYPE_PASSIVE] = "data/ui_gfx/inventory/item_bg_passive.png",
[ACTION_TYPE_PROJECTILE] = "data/ui_gfx/inventory/item_bg_projectile.png",
[ACTION_TYPE_STATIC_PROJECTILE] = "data/ui_gfx/inventory/item_bg_static_projectile.png",
[ACTION_TYPE_MODIFIER] = "data/ui_gfx/inventory/item_bg_modifier.png",
[ACTION_TYPE_DRAW_MANY] = "data/ui_gfx/inventory/item_bg_draw_many.png",
[ACTION_TYPE_MATERIAL] = "data/ui_gfx/inventory/item_bg_material.png",
[ACTION_TYPE_OTHER] = "data/ui_gfx/inventory/item_bg_other.png",
[ACTION_TYPE_UTILITY] = "data/ui_gfx/inventory/item_bg_utility.png",
[ACTION_TYPE_PASSIVE] = "data/ui_gfx/inventory/item_bg_passive.png",
}
local function get_spell_bg(action_id)
return spell_type_bgs[spell_lookup[action_id] and spell_lookup[action_id].type] or spell_type_bgs[ACTION_TYPE_OTHER]
return spell_type_bgs[spell_lookup[action_id] and spell_lookup[action_id].type] or spell_type_bgs[ACTION_TYPE_OTHER]
end
-- This function is a giant mess, but it works :)
@ -904,7 +904,7 @@ function wand:GetFreeSlotsCount()
end
-- Returns: spells_count, always_cast_spells_count
function wand:GetSpellsCount()
local children = EntityGetAllChildren(self.entity_id)
local children = EntityGetAllChildren(self.entity_id)
if children == nil then
return 0, 0
end
@ -917,7 +917,7 @@ function wand:GetSpellsCount()
end
end
return #children - always_cast_spells_count, always_cast_spells_count
return #children - always_cast_spells_count, always_cast_spells_count
end
-- Returns two values:
-- 1: table of spells with each entry having the format { action_id = "BLACK_HOLE", inventory_x = 1, entity_id = <action_entity_id> }
@ -925,15 +925,15 @@ end
-- inventory_x should give the position in the wand slots, 1 = first up to num_slots
-- inventory_x is not working yet
function wand:GetSpells()
local spells = {}
local always_cast_spells = {}
local children = EntityGetAllChildren(self.entity_id)
local spells = {}
local always_cast_spells = {}
local children = EntityGetAllChildren(self.entity_id)
if children == nil then
return spells, always_cast_spells
end
for _, spell in ipairs(children) do
local action_id = nil
local permanent = false
for _, spell in ipairs(children) do
local action_id = nil
local permanent = false
local uses_remaining = -1
local item_action_component = EntityGetFirstComponentIncludingDisabled(spell, "ItemActionComponent")
if item_action_component then
@ -947,12 +947,12 @@ function wand:GetSpells()
uses_remaining = ComponentGetValue2(item_component, "uses_remaining")
end
if action_id then
if permanent == true then
table.insert(always_cast_spells, { action_id = action_id, entity_id = spell, inventory_x = inventory_x, inventory_y = inventory_y })
else
table.insert(spells, { action_id = action_id, entity_id = spell, uses_remaining = uses_remaining, inventory_x = inventory_x, inventory_y = inventory_y })
end
end
if permanent == true then
table.insert(always_cast_spells, { action_id = action_id, entity_id = spell, inventory_x = inventory_x, inventory_y = inventory_y })
else
table.insert(spells, { action_id = action_id, entity_id = spell, uses_remaining = uses_remaining, inventory_x = inventory_x, inventory_y = inventory_y })
end
end
end
local function assign_inventory_x(t)
@ -983,11 +983,11 @@ function wand:GetSpells()
-- and assign inventory_x to either what it was set as or by the order the entities appear on the wand
assign_inventory_x(spells)
table.sort(spells, function(a, b) return a.inventory_x < b.inventory_x end)
return spells, always_cast_spells
return spells, always_cast_spells
end
function wand:_RemoveSpells(spells_to_remove, detach)
local spells, attached_spells = self:GetSpells()
local spells, attached_spells = self:GetSpells()
local which = detach and attached_spells or spells
local spells_to_remove_remaining = {}
for _, spell in ipairs(spells_to_remove) do
@ -1050,36 +1050,36 @@ function wand:SetFrozen(freeze_wand, freeze_spells)
end
function wand:SetSprite(item_file, offset_x, offset_y, tip_x, tip_y)
if self.ability_component then
if self.ability_component then
ComponentSetValue2(self.ability_component, "sprite_file", item_file)
end
end
local sprite_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "SpriteComponent", "item")
if sprite_comp then
ComponentSetValue2(sprite_comp, "image_file", item_file)
ComponentSetValue2(sprite_comp, "offset_x", offset_x)
ComponentSetValue2(sprite_comp, "offset_y", offset_y)
EntityRefreshSprite(self.entity_id, sprite_comp)
end
local hotspot_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "HotspotComponent", "shoot_pos")
end
local hotspot_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "HotspotComponent", "shoot_pos")
if hotspot_comp then
ComponentSetValue2(hotspot_comp, "offset", tip_x, tip_y)
end
end
end
function wand:GetSprite()
local sprite_file, offset_x, offset_y, tip_x, tip_y = "", 0, 0, 0, 0
if self.ability_component then
sprite_file = ComponentGetValue2(self.ability_component, "sprite_file")
end
local sprite_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "SpriteComponent", "item")
if sprite_comp then
if self.ability_component then
sprite_file = ComponentGetValue2(self.ability_component, "sprite_file")
end
local sprite_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "SpriteComponent", "item")
if sprite_comp then
if sprite_file == "" then
sprite_file = ComponentGetValue2(sprite_comp, "image_file")
end
offset_x = ComponentGetValue2(sprite_comp, "offset_x")
offset_y = ComponentGetValue2(sprite_comp, "offset_y")
end
local hotspot_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "HotspotComponent", "shoot_pos")
end
local hotspot_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "HotspotComponent", "shoot_pos")
if hotspot_comp then
tip_x, tip_y = ComponentGetValue2(hotspot_comp, "offset")
end
@ -1106,40 +1106,40 @@ end
which ruins things in biome scripts
]]
function WandDiff( gun, wand )
local score = 0
score = score + ( math.abs( gun.fire_rate_wait - wand.fire_rate_wait ) * 2 )
score = score + ( math.abs( gun.actions_per_round - wand.actions_per_round ) * 20 )
score = score + ( math.abs( gun.shuffle_deck_when_empty - wand.shuffle_deck_when_empty ) * 30 )
score = score + ( math.abs( gun.deck_capacity - wand.deck_capacity ) * 5 )
score = score + math.abs( gun.spread_degrees - wand.spread_degrees )
score = score + math.abs( gun.reload_time - wand.reload_time )
return score
local score = 0
score = score + ( math.abs( gun.fire_rate_wait - wand.fire_rate_wait ) * 2 )
score = score + ( math.abs( gun.actions_per_round - wand.actions_per_round ) * 20 )
score = score + ( math.abs( gun.shuffle_deck_when_empty - wand.shuffle_deck_when_empty ) * 30 )
score = score + ( math.abs( gun.deck_capacity - wand.deck_capacity ) * 5 )
score = score + math.abs( gun.spread_degrees - wand.spread_degrees )
score = score + math.abs( gun.reload_time - wand.reload_time )
return score
end
function GetWand( gun )
local best_wand = nil
local best_score = 1000
local gun_in_wand_space = {}
local best_wand = nil
local best_score = 1000
local gun_in_wand_space = {}
gun_in_wand_space.fire_rate_wait = clamp(((gun["fire_rate_wait"] + 5) / 7)-1, 0, 4)
gun_in_wand_space.actions_per_round = clamp(gun["actions_per_round"]-1,0,2)
gun_in_wand_space.shuffle_deck_when_empty = clamp(gun["shuffle_deck_when_empty"], 0, 1)
gun_in_wand_space.deck_capacity = clamp( (gun["deck_capacity"]-3)/3, 0, 7 ) -- TODO
gun_in_wand_space.spread_degrees = clamp( ((gun["spread_degrees"] + 5 ) / 5 ) - 1, 0, 2 )
gun_in_wand_space.reload_time = clamp( ((gun["reload_time"]+5)/25)-1, 0, 2 )
gun_in_wand_space.fire_rate_wait = clamp(((gun["fire_rate_wait"] + 5) / 7)-1, 0, 4)
gun_in_wand_space.actions_per_round = clamp(gun["actions_per_round"]-1,0,2)
gun_in_wand_space.shuffle_deck_when_empty = clamp(gun["shuffle_deck_when_empty"], 0, 1)
gun_in_wand_space.deck_capacity = clamp( (gun["deck_capacity"]-3)/3, 0, 7 ) -- TODO
gun_in_wand_space.spread_degrees = clamp( ((gun["spread_degrees"] + 5 ) / 5 ) - 1, 0, 2 )
gun_in_wand_space.reload_time = clamp( ((gun["reload_time"]+5)/25)-1, 0, 2 )
for k,wand in pairs(wands) do
local score = WandDiff( gun_in_wand_space, wand )
if( score <= best_score ) then
best_wand = wand
best_score = score
-- just randomly return one of them...
if( score == 0 and Random(0,100) < 33 ) then
return best_wand
end
end
end
return best_wand
for k,wand in pairs(wands) do
local score = WandDiff( gun_in_wand_space, wand )
if( score <= best_score ) then
best_wand = wand
best_score = score
-- just randomly return one of them...
if( score == 0 and Random(0,100) < 33 ) then
return best_wand
end
end
end
return best_wand
end
--[[ /data/scripts/gun/procedural/gun_procedural.lua ]]
@ -1197,13 +1197,13 @@ function wand:PickUp(entity)
EntityAddChild( child, self.entity_id)
end
end
EntitySetComponentsWithTagEnabled( self.entity_id, "enabled_in_world", false )
EntitySetComponentsWithTagEnabled( self.entity_id, "enabled_in_hand", false )
EntitySetComponentsWithTagEnabled( self.entity_id, "enabled_in_inventory", true )
local wand_children = EntityGetAllChildren(self.entity_id) or {}
for k, v in ipairs(wand_children)do
EntitySetComponentsWithTagEnabled( self.entity_id, "enabled_in_world", false )
end
@ -1212,17 +1212,17 @@ function wand:PickUp(entity)
if sprite_particle_emitter_comp ~= nil then
EntitySetComponentIsEnabled(self.entity_id, sprite_particle_emitter_comp, false)
end
end
function wand:PlaceAt(x, y)
EntitySetComponentIsEnabled(self.entity_id, self.ability_component, true)
local hotspot_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "HotspotComponent")
EntitySetComponentIsEnabled(self.entity_id, hotspot_comp, true)
EntitySetComponentIsEnabled(self.entity_id, self.ability_component, true)
local hotspot_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "HotspotComponent")
EntitySetComponentIsEnabled(self.entity_id, hotspot_comp, true)
local item_component = EntityGetFirstComponentIncludingDisabled(self.entity_id, "ItemComponent")
EntitySetComponentIsEnabled(self.entity_id, item_component, true)
local sprite_component = EntityGetFirstComponentIncludingDisabled(self.entity_id, "SpriteComponent")
EntitySetComponentIsEnabled(self.entity_id, sprite_component, true)
EntitySetComponentIsEnabled(self.entity_id, item_component, true)
local sprite_component = EntityGetFirstComponentIncludingDisabled(self.entity_id, "SpriteComponent")
EntitySetComponentIsEnabled(self.entity_id, sprite_component, true)
local light_component = EntityGetFirstComponentIncludingDisabled(self.entity_id, "LightComponent")
EntitySetComponentIsEnabled(self.entity_id, light_component, true)
@ -1230,17 +1230,17 @@ function wand:PlaceAt(x, y)
ComponentSetValue(item_component, "play_hover_animation", "1")
ComponentSetValueVector2(item_component, "spawn_pos", x, y)
local lua_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "LuaComponent")
EntitySetComponentIsEnabled(self.entity_id, lua_comp, true)
local simple_physics_component = EntityGetFirstComponentIncludingDisabled(self.entity_id, "SimplePhysicsComponent")
local lua_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "LuaComponent")
EntitySetComponentIsEnabled(self.entity_id, lua_comp, true)
local simple_physics_component = EntityGetFirstComponentIncludingDisabled(self.entity_id, "SimplePhysicsComponent")
EntitySetComponentIsEnabled(self.entity_id, simple_physics_component, false)
-- Does this wand have a ray particle effect? Most do, except the starter wands
local sprite_particle_emitter_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "SpriteParticleEmitterComponent")
if sprite_particle_emitter_comp ~= nil then
EntitySetComponentIsEnabled(self.entity_id, sprite_particle_emitter_comp, true)
else
-- TODO: As soon as there's some way to clone Components or Transplant/Remove+Add to another Entity, copy
-- the SpriteParticleEmitterComponent of entities/base_wand.xml
-- Does this wand have a ray particle effect? Most do, except the starter wands
local sprite_particle_emitter_comp = EntityGetFirstComponentIncludingDisabled(self.entity_id, "SpriteParticleEmitterComponent")
if sprite_particle_emitter_comp ~= nil then
EntitySetComponentIsEnabled(self.entity_id, sprite_particle_emitter_comp, true)
else
-- TODO: As soon as there's some way to clone Components or Transplant/Remove+Add to another Entity, copy
-- the SpriteParticleEmitterComponent of entities/base_wand.xml
end
end
@ -1337,7 +1337,7 @@ function wand:Serialize(include_mana, include_offsets)
end
local function get_held_wand()
local player = EntityGetWithTag("player_unit")[1]
local player = EntityGetWithTag("player_unit")[1]
if player then
local inventory2_comp = EntityGetFirstComponentIncludingDisabled(player, "Inventory2Component")
local active_item = ComponentGetValue2(inventory2_comp, "mActiveItem")
@ -1382,4 +1382,4 @@ return setmetatable({}, {
GetAllWands = get_all_wands,
})[key]
end
})
})

View file

@ -34,107 +34,107 @@ local includeMetatables = true -- togglable with bitser.includeMetatables(false)
local SEEN_LEN = {}
local function Buffer_prereserve(min_size)
if buf_size < min_size then
buf_size = min_size
buf = ffi.new("uint8_t[?]", buf_size)
buf_is_writable = true
end
if buf_size < min_size then
buf_size = min_size
buf = ffi.new("uint8_t[?]", buf_size)
buf_is_writable = true
end
end
local function Buffer_clear()
buf_size = -1
buf = nil
buf_is_writable = true
writable_buf = nil
writable_buf_size = nil
buf_size = -1
buf = nil
buf_is_writable = true
writable_buf = nil
writable_buf_size = nil
end
local function Buffer_makeBuffer(size)
if not buf_is_writable then
buf = writable_buf
buf_size = writable_buf_size
writable_buf = nil
writable_buf_size = nil
buf_is_writable = true
end
buf_pos = 0
Buffer_prereserve(size)
if not buf_is_writable then
buf = writable_buf
buf_size = writable_buf_size
writable_buf = nil
writable_buf_size = nil
buf_is_writable = true
end
buf_pos = 0
Buffer_prereserve(size)
end
local function Buffer_newReader(str)
Buffer_makeBuffer(#str)
ffi.copy(buf, str, #str)
Buffer_makeBuffer(#str)
ffi.copy(buf, str, #str)
end
local function Buffer_newDataReader(data, size)
if buf_is_writable then
writable_buf = buf
writable_buf_size = buf_size
end
buf_is_writable = false
buf_pos = 0
buf_size = size
buf = ffi.cast("uint8_t*", data)
if buf_is_writable then
writable_buf = buf
writable_buf_size = buf_size
end
buf_is_writable = false
buf_pos = 0
buf_size = size
buf = ffi.cast("uint8_t*", data)
end
local function Buffer_reserve(additional_size)
while buf_pos + additional_size > buf_size do
buf_size = buf_size * 2
local oldbuf = buf
buf = ffi.new("uint8_t[?]", buf_size)
buf_is_writable = true
ffi.copy(buf, oldbuf, buf_pos)
end
while buf_pos + additional_size > buf_size do
buf_size = buf_size * 2
local oldbuf = buf
buf = ffi.new("uint8_t[?]", buf_size)
buf_is_writable = true
ffi.copy(buf, oldbuf, buf_pos)
end
end
local function Buffer_write_byte(x)
Buffer_reserve(1)
buf[buf_pos] = x
buf_pos = buf_pos + 1
Buffer_reserve(1)
buf[buf_pos] = x
buf_pos = buf_pos + 1
end
local function Buffer_write_raw(data, len)
Buffer_reserve(len)
ffi.copy(buf + buf_pos, data, len)
buf_pos = buf_pos + len
Buffer_reserve(len)
ffi.copy(buf + buf_pos, data, len)
buf_pos = buf_pos + len
end
local function Buffer_write_string(s)
Buffer_write_raw(s, #s)
Buffer_write_raw(s, #s)
end
local function Buffer_write_data(ct, len, ...)
Buffer_write_raw(ffi.new(ct, ...), len)
Buffer_write_raw(ffi.new(ct, ...), len)
end
local function Buffer_ensure(numbytes)
if buf_pos + numbytes > buf_size then
error("malformed serialized data")
end
if buf_pos + numbytes > buf_size then
error("malformed serialized data")
end
end
local function Buffer_read_byte()
Buffer_ensure(1)
local x = buf[buf_pos]
buf_pos = buf_pos + 1
return x
Buffer_ensure(1)
local x = buf[buf_pos]
buf_pos = buf_pos + 1
return x
end
local function Buffer_read_string(len)
Buffer_ensure(len)
local x = ffi.string(buf + buf_pos, len)
buf_pos = buf_pos + len
return x
Buffer_ensure(len)
local x = ffi.string(buf + buf_pos, len)
buf_pos = buf_pos + len
return x
end
local function Buffer_read_raw(data, len)
ffi.copy(data, buf + buf_pos, len)
buf_pos = buf_pos + len
return data
ffi.copy(data, buf + buf_pos, len)
buf_pos = buf_pos + len
return data
end
local function Buffer_read_data(ct, len)
return Buffer_read_raw(ffi.new(ct), len)
return Buffer_read_raw(ffi.new(ct), len)
end
local resource_registry = {}
@ -147,350 +147,350 @@ local class_deserialize_registry = {}
local serialize_value
local function write_number(value, _)
if floor(value) == value and value >= -2147483648 and value <= 2147483647 then
if value >= -27 and value <= 100 then
--small int
Buffer_write_byte(value + 27)
elseif value >= -32768 and value <= 32767 then
--short int
Buffer_write_byte(250)
Buffer_write_data("int16_t[1]", 2, value)
else
--long int
Buffer_write_byte(245)
Buffer_write_data("int32_t[1]", 4, value)
end
else
--double
Buffer_write_byte(246)
Buffer_write_data("double[1]", 8, value)
end
if floor(value) == value and value >= -2147483648 and value <= 2147483647 then
if value >= -27 and value <= 100 then
--small int
Buffer_write_byte(value + 27)
elseif value >= -32768 and value <= 32767 then
--short int
Buffer_write_byte(250)
Buffer_write_data("int16_t[1]", 2, value)
else
--long int
Buffer_write_byte(245)
Buffer_write_data("int32_t[1]", 4, value)
end
else
--double
Buffer_write_byte(246)
Buffer_write_data("double[1]", 8, value)
end
end
local function write_string(value, _)
if #value < 32 then
--short string
Buffer_write_byte(192 + #value)
else
--long string
Buffer_write_byte(244)
write_number(#value)
end
Buffer_write_string(value)
if #value < 32 then
--short string
Buffer_write_byte(192 + #value)
else
--long string
Buffer_write_byte(244)
write_number(#value)
end
Buffer_write_string(value)
end
local function write_nil(_, _)
Buffer_write_byte(247)
Buffer_write_byte(247)
end
local function write_boolean(value, _)
Buffer_write_byte(value and 249 or 248)
Buffer_write_byte(value and 249 or 248)
end
local function write_table(value, seen)
local classkey
local metatable = getmetatable(value)
local classname = (class_name_registry[value.class] -- MiddleClass
or class_name_registry[value.__baseclass] -- SECL
or class_name_registry[metatable] -- hump.class
or class_name_registry[value.__class__] -- Slither
or class_name_registry[value.__class]) -- Moonscript class
if classname then
classkey = classkey_registry[classname]
Buffer_write_byte(242)
serialize_value(classname, seen)
elseif includeMetatables and metatable then
Buffer_write_byte(253)
else
Buffer_write_byte(240)
end
local len = #value
write_number(len, seen)
for i = 1, len do
serialize_value(value[i], seen)
end
local klen = 0
for k in pairs(value) do
if (type(k) ~= 'number' or floor(k) ~= k or k > len or k < 1) and k ~= classkey then
klen = klen + 1
end
end
write_number(klen, seen)
for k, v in pairs(value) do
if (type(k) ~= 'number' or floor(k) ~= k or k > len or k < 1) and k ~= classkey then
serialize_value(k, seen)
serialize_value(v, seen)
end
end
if includeMetatables and metatable and not classname then
serialize_value(metatable, seen)
end
local classkey
local metatable = getmetatable(value)
local classname = (class_name_registry[value.class] -- MiddleClass
or class_name_registry[value.__baseclass] -- SECL
or class_name_registry[metatable] -- hump.class
or class_name_registry[value.__class__] -- Slither
or class_name_registry[value.__class]) -- Moonscript class
if classname then
classkey = classkey_registry[classname]
Buffer_write_byte(242)
serialize_value(classname, seen)
elseif includeMetatables and metatable then
Buffer_write_byte(253)
else
Buffer_write_byte(240)
end
local len = #value
write_number(len, seen)
for i = 1, len do
serialize_value(value[i], seen)
end
local klen = 0
for k in pairs(value) do
if (type(k) ~= 'number' or floor(k) ~= k or k > len or k < 1) and k ~= classkey then
klen = klen + 1
end
end
write_number(klen, seen)
for k, v in pairs(value) do
if (type(k) ~= 'number' or floor(k) ~= k or k > len or k < 1) and k ~= classkey then
serialize_value(k, seen)
serialize_value(v, seen)
end
end
if includeMetatables and metatable and not classname then
serialize_value(metatable, seen)
end
end
local function write_cdata(value, seen)
local ty = ffi.typeof(value)
if ty == value then
-- ctype
Buffer_write_byte(251)
serialize_value(tostring(ty):sub(7, -2), seen)
return
end
-- cdata
Buffer_write_byte(252)
serialize_value(ty, seen)
local len = ffi.sizeof(value)
write_number(len)
Buffer_write_raw(ffi.typeof('$[1]', ty)(value), len)
local ty = ffi.typeof(value)
if ty == value then
-- ctype
Buffer_write_byte(251)
serialize_value(tostring(ty):sub(7, -2), seen)
return
end
-- cdata
Buffer_write_byte(252)
serialize_value(ty, seen)
local len = ffi.sizeof(value)
write_number(len)
Buffer_write_raw(ffi.typeof('$[1]', ty)(value), len)
end
local types = {number = write_number, string = write_string, table = write_table, boolean = write_boolean, ["nil"] = write_nil, cdata = write_cdata}
serialize_value = function(value, seen)
if seen[value] then
local ref = seen[value]
if ref < 64 then
--small reference
Buffer_write_byte(128 + ref)
else
--long reference
Buffer_write_byte(243)
write_number(ref, seen)
end
return
end
local t = type(value)
if t ~= 'number' and t ~= 'boolean' and t ~= 'nil' and t ~= 'cdata' then
seen[value] = seen[SEEN_LEN]
seen[SEEN_LEN] = seen[SEEN_LEN] + 1
end
if resource_name_registry[value] then
local name = resource_name_registry[value]
if #name < 16 then
--small resource
Buffer_write_byte(224 + #name)
Buffer_write_string(name)
else
--long resource
Buffer_write_byte(241)
write_string(name, seen)
end
return
end
(types[t] or
error("cannot serialize type " .. t)
)(value, seen)
if seen[value] then
local ref = seen[value]
if ref < 64 then
--small reference
Buffer_write_byte(128 + ref)
else
--long reference
Buffer_write_byte(243)
write_number(ref, seen)
end
return
end
local t = type(value)
if t ~= 'number' and t ~= 'boolean' and t ~= 'nil' and t ~= 'cdata' then
seen[value] = seen[SEEN_LEN]
seen[SEEN_LEN] = seen[SEEN_LEN] + 1
end
if resource_name_registry[value] then
local name = resource_name_registry[value]
if #name < 16 then
--small resource
Buffer_write_byte(224 + #name)
Buffer_write_string(name)
else
--long resource
Buffer_write_byte(241)
write_string(name, seen)
end
return
end
(types[t] or
error("cannot serialize type " .. t)
)(value, seen)
end
local function serialize(value)
Buffer_makeBuffer(4096)
local seen = {[SEEN_LEN] = 0}
serialize_value(value, seen)
Buffer_makeBuffer(4096)
local seen = {[SEEN_LEN] = 0}
serialize_value(value, seen)
end
local function add_to_seen(value, seen)
insert(seen, value)
return value
insert(seen, value)
return value
end
local function reserve_seen(seen)
insert(seen, 42)
return #seen
insert(seen, 42)
return #seen
end
local function deserialize_value(seen)
local t = Buffer_read_byte()
if t < 128 then
--small int
return t - 27
elseif t < 192 then
--small reference
return seen[t - 127]
elseif t < 224 then
--small string
return add_to_seen(Buffer_read_string(t - 192), seen)
elseif t < 240 then
--small resource
return add_to_seen(resource_registry[Buffer_read_string(t - 224)], seen)
elseif t == 240 or t == 253 then
--table
local v = add_to_seen({}, seen)
local len = deserialize_value(seen)
for i = 1, len do
v[i] = deserialize_value(seen)
end
len = deserialize_value(seen)
for _ = 1, len do
local key = deserialize_value(seen)
v[key] = deserialize_value(seen)
end
if t == 253 then
if includeMetatables then
setmetatable(v, deserialize_value(seen))
end
end
return v
elseif t == 241 then
--long resource
local idx = reserve_seen(seen)
local value = resource_registry[deserialize_value(seen)]
seen[idx] = value
return value
elseif t == 242 then
--instance
local instance = add_to_seen({}, seen)
local classname = deserialize_value(seen)
local class = class_registry[classname]
local classkey = classkey_registry[classname]
local deserializer = class_deserialize_registry[classname]
local len = deserialize_value(seen)
for i = 1, len do
instance[i] = deserialize_value(seen)
end
len = deserialize_value(seen)
for _ = 1, len do
local key = deserialize_value(seen)
instance[key] = deserialize_value(seen)
end
if classkey then
instance[classkey] = class
end
return deserializer(instance, class)
elseif t == 243 then
--reference
return seen[deserialize_value(seen) + 1]
elseif t == 244 then
--long string
return add_to_seen(Buffer_read_string(deserialize_value(seen)), seen)
elseif t == 245 then
--long int
return Buffer_read_data("int32_t[1]", 4)[0]
elseif t == 246 then
--double
return Buffer_read_data("double[1]", 8)[0]
elseif t == 247 then
--nil
return nil
elseif t == 248 then
--false
return false
elseif t == 249 then
--true
return true
elseif t == 250 then
--short int
return Buffer_read_data("int16_t[1]", 2)[0]
elseif t == 251 then
--ctype
return ffi.typeof(deserialize_value(seen))
elseif t == 252 then
local ctype = deserialize_value(seen)
local len = deserialize_value(seen)
local read_into = ffi.typeof('$[1]', ctype)()
Buffer_read_raw(read_into, len)
return ctype(read_into[0])
else
error("unsupported serialized type " .. t)
end
local t = Buffer_read_byte()
if t < 128 then
--small int
return t - 27
elseif t < 192 then
--small reference
return seen[t - 127]
elseif t < 224 then
--small string
return add_to_seen(Buffer_read_string(t - 192), seen)
elseif t < 240 then
--small resource
return add_to_seen(resource_registry[Buffer_read_string(t - 224)], seen)
elseif t == 240 or t == 253 then
--table
local v = add_to_seen({}, seen)
local len = deserialize_value(seen)
for i = 1, len do
v[i] = deserialize_value(seen)
end
len = deserialize_value(seen)
for _ = 1, len do
local key = deserialize_value(seen)
v[key] = deserialize_value(seen)
end
if t == 253 then
if includeMetatables then
setmetatable(v, deserialize_value(seen))
end
end
return v
elseif t == 241 then
--long resource
local idx = reserve_seen(seen)
local value = resource_registry[deserialize_value(seen)]
seen[idx] = value
return value
elseif t == 242 then
--instance
local instance = add_to_seen({}, seen)
local classname = deserialize_value(seen)
local class = class_registry[classname]
local classkey = classkey_registry[classname]
local deserializer = class_deserialize_registry[classname]
local len = deserialize_value(seen)
for i = 1, len do
instance[i] = deserialize_value(seen)
end
len = deserialize_value(seen)
for _ = 1, len do
local key = deserialize_value(seen)
instance[key] = deserialize_value(seen)
end
if classkey then
instance[classkey] = class
end
return deserializer(instance, class)
elseif t == 243 then
--reference
return seen[deserialize_value(seen) + 1]
elseif t == 244 then
--long string
return add_to_seen(Buffer_read_string(deserialize_value(seen)), seen)
elseif t == 245 then
--long int
return Buffer_read_data("int32_t[1]", 4)[0]
elseif t == 246 then
--double
return Buffer_read_data("double[1]", 8)[0]
elseif t == 247 then
--nil
return nil
elseif t == 248 then
--false
return false
elseif t == 249 then
--true
return true
elseif t == 250 then
--short int
return Buffer_read_data("int16_t[1]", 2)[0]
elseif t == 251 then
--ctype
return ffi.typeof(deserialize_value(seen))
elseif t == 252 then
local ctype = deserialize_value(seen)
local len = deserialize_value(seen)
local read_into = ffi.typeof('$[1]', ctype)()
Buffer_read_raw(read_into, len)
return ctype(read_into[0])
else
error("unsupported serialized type " .. t)
end
end
local function deserialize_MiddleClass(instance, class)
return setmetatable(instance, class.__instanceDict)
return setmetatable(instance, class.__instanceDict)
end
local function deserialize_SECL(instance, class)
return setmetatable(instance, getmetatable(class))
return setmetatable(instance, getmetatable(class))
end
local deserialize_humpclass = setmetatable
local function deserialize_Slither(instance, class)
return getmetatable(class).allocate(instance)
return getmetatable(class).allocate(instance)
end
local function deserialize_Moonscript(instance, class)
return setmetatable(instance, class.__base)
return setmetatable(instance, class.__base)
end
return {dumps = function(value)
serialize(value)
return ffi.string(buf, buf_pos)
serialize(value)
return ffi.string(buf, buf_pos)
end, dumpLoveFile = function(fname, value)
serialize(value)
assert(love.filesystem.write(fname, ffi.string(buf, buf_pos)))
serialize(value)
assert(love.filesystem.write(fname, ffi.string(buf, buf_pos)))
end, loadLoveFile = function(fname)
local serializedData, error = love.filesystem.newFileData(fname)
assert(serializedData, error)
Buffer_newDataReader(serializedData:getPointer(), serializedData:getSize())
local value = deserialize_value({})
-- serializedData needs to not be collected early in a tail-call
-- so make sure deserialize_value returns before loadLoveFile does
return value
local serializedData, error = love.filesystem.newFileData(fname)
assert(serializedData, error)
Buffer_newDataReader(serializedData:getPointer(), serializedData:getSize())
local value = deserialize_value({})
-- serializedData needs to not be collected early in a tail-call
-- so make sure deserialize_value returns before loadLoveFile does
return value
end, loadData = function(data, size)
if size == 0 then
error('cannot load value from empty data')
end
Buffer_newDataReader(data, size)
return deserialize_value({})
if size == 0 then
error('cannot load value from empty data')
end
Buffer_newDataReader(data, size)
return deserialize_value({})
end, loads = function(str)
if #str == 0 then
error('cannot load value from empty string')
end
Buffer_newReader(str)
return deserialize_value({})
if #str == 0 then
error('cannot load value from empty string')
end
Buffer_newReader(str)
return deserialize_value({})
end, includeMetatables = function(bool)
includeMetatables = not not bool
includeMetatables = not not bool
end, register = function(name, resource)
assert(not resource_registry[name], name .. " already registered")
resource_registry[name] = resource
resource_name_registry[resource] = name
return resource
assert(not resource_registry[name], name .. " already registered")
resource_registry[name] = resource
resource_name_registry[resource] = name
return resource
end, unregister = function(name)
resource_name_registry[resource_registry[name]] = nil
resource_registry[name] = nil
resource_name_registry[resource_registry[name]] = nil
resource_registry[name] = nil
end, registerClass = function(name, class, classkey, deserializer)
if not class then
class = name
name = class.__name__ or class.name or class.__name
end
if not classkey then
if class.__instanceDict then
-- assume MiddleClass
classkey = 'class'
elseif class.__baseclass then
-- assume SECL
classkey = '__baseclass'
end
-- assume hump.class, Slither, Moonscript class or something else that doesn't store the
-- class directly on the instance
end
if not deserializer then
if class.__instanceDict then
-- assume MiddleClass
deserializer = deserialize_MiddleClass
elseif class.__baseclass then
-- assume SECL
deserializer = deserialize_SECL
elseif class.__index == class then
-- assume hump.class
deserializer = deserialize_humpclass
elseif class.__name__ then
-- assume Slither
deserializer = deserialize_Slither
elseif class.__base then
-- assume Moonscript class
deserializer = deserialize_Moonscript
else
error("no deserializer given for unsupported class library")
end
end
class_registry[name] = class
classkey_registry[name] = classkey
class_deserialize_registry[name] = deserializer
class_name_registry[class] = name
return class
if not class then
class = name
name = class.__name__ or class.name or class.__name
end
if not classkey then
if class.__instanceDict then
-- assume MiddleClass
classkey = 'class'
elseif class.__baseclass then
-- assume SECL
classkey = '__baseclass'
end
-- assume hump.class, Slither, Moonscript class or something else that doesn't store the
-- class directly on the instance
end
if not deserializer then
if class.__instanceDict then
-- assume MiddleClass
deserializer = deserialize_MiddleClass
elseif class.__baseclass then
-- assume SECL
deserializer = deserialize_SECL
elseif class.__index == class then
-- assume hump.class
deserializer = deserialize_humpclass
elseif class.__name__ then
-- assume Slither
deserializer = deserialize_Slither
elseif class.__base then
-- assume Moonscript class
deserializer = deserialize_Moonscript
else
error("no deserializer given for unsupported class library")
end
end
class_registry[name] = class
classkey_registry[name] = classkey
class_deserialize_registry[name] = deserializer
class_name_registry[class] = name
return class
end, unregisterClass = function(name)
class_name_registry[class_registry[name]] = nil
classkey_registry[name] = nil
class_deserialize_registry[name] = nil
class_registry[name] = nil
class_name_registry[class_registry[name]] = nil
classkey_registry[name] = nil
class_deserialize_registry[name] = nil
class_registry[name] = nil
end, reserveBuffer = Buffer_prereserve, clearBuffer = Buffer_clear, version = VERSION}

View file

@ -1,4 +1,4 @@
<MagicNumbers
_DEBUG_DONT_SAVE_MAGIC_NUMBERS="1"
_DEBUG_DONT_SAVE_MAGIC_NUMBERS="1"
>
</MagicNumbers>

View file

@ -1,7 +1,7 @@
function heal_entity(entity_id, heal_amount)
CrossCall("ew_ds_damaged", -heal_amount, "healed", entity_id, true)
-- gfx effect
local x, y = EntityGetTransform( entity_id )
local entity_fx = EntityLoad( "data/entities/particles/heal_effect.xml", x, y )
EntityAddChild( entity_id, entity_fx )
end
local x, y = EntityGetTransform( entity_id )
local entity_fx = EntityLoad( "data/entities/particles/heal_effect.xml", x, y )
EntityAddChild( entity_id, entity_fx )
end

View file

@ -1,40 +1,40 @@
<Entity>
<InheritTransformComponent
_enabled="1" >
</InheritTransformComponent>
<InheritTransformComponent
_enabled="1" >
</InheritTransformComponent>
<LuaComponent
script_source_file="mods/quant.ew/files/system/damage/append/hearty_start.lua"
execute_every_n_frame="4"
remove_after_executed="1"
>
</LuaComponent>
<LuaComponent
script_source_file="mods/quant.ew/files/system/damage/append/hearty_end.lua"
execute_every_n_frame="-1"
execute_on_removed="1"
>
</LuaComponent>
<VariableStorageComponent
name="effect_hearty"
value_float="0.0"
>
</VariableStorageComponent>
<LifetimeComponent
lifetime="1200"
>
</LifetimeComponent>
<UIIconComponent
name="$status_hearty"
description="$statusdesc_hearty"
icon_sprite_file="data/ui_gfx/status_indicators/hearty.png"
is_perk="0"
display_above_head="0"
display_in_hud="1"
>
</UIIconComponent>
</Entity>
script_source_file="mods/quant.ew/files/system/damage/append/hearty_start.lua"
execute_every_n_frame="4"
remove_after_executed="1"
>
</LuaComponent>
<LuaComponent
script_source_file="mods/quant.ew/files/system/damage/append/hearty_end.lua"
execute_every_n_frame="-1"
execute_on_removed="1"
>
</LuaComponent>
<VariableStorageComponent
name="effect_hearty"
value_float="0.0"
>
</VariableStorageComponent>
<LifetimeComponent
lifetime="1200"
>
</LifetimeComponent>
<UIIconComponent
name="$status_hearty"
description="$statusdesc_hearty"
icon_sprite_file="data/ui_gfx/status_indicators/hearty.png"
is_perk="0"
display_above_head="0"
display_in_hud="1"
>
</UIIconComponent>
</Entity>

View file

@ -183,8 +183,8 @@ end
function rpc.healing_effect()
local entity_id = ctx.rpc_player_data.entity
local x, y = EntityGetTransform( entity_id )
local entity_fx = EntityLoad( "data/entities/particles/heal_effect.xml", x, y )
EntityAddChild( entity_id, entity_fx )
local entity_fx = EntityLoad( "data/entities/particles/heal_effect.xml", x, y )
EntityAddChild( entity_id, entity_fx )
end
rpc.opts_reliable()

View file

@ -1,63 +1,63 @@
<Entity name="unknown" >
<ParticleEmitterComponent
emitted_material_name="spark_yellow"
gravity.y="0.0"
lifetime_min="5.5"
lifetime_max="25.5"
count_min="10"
count_max="20"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.max="256"
cosmetic_force_create="0"
airflow_force="0.5"
airflow_time="0.01"
airflow_scale="0.05"
attractor_force="2"
emission_interval_min_frames="1"
emission_interval_max_frames="1"
emit_cosmetic_particles="1"
is_emitting="1" >
</ParticleEmitterComponent>
<ParticleEmitterComponent
emitted_material_name="gold"
gravity.y="0.0"
lifetime_min="15.5"
lifetime_max="25.5"
count_min="1"
count_max="3"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.max="32"
cosmetic_force_create="0"
airflow_force="0.5"
airflow_time="0.01"
airflow_scale="0.05"
attractor_force="2"
emission_interval_min_frames="1"
emission_interval_max_frames="1"
emit_cosmetic_particles="1"
>
</ParticleEmitterComponent>
<VelocityComponent
gravity_y="0"
mass="0.1"
>
</VelocityComponent>
<HomingComponent
target_tag="prey"
homing_targeting_coeff="30"
detect_distance="800"
homing_velocity_multiplier="0.9"
>
</HomingComponent>
<ProjectileComponent
_enabled="1"
<ParticleEmitterComponent
emitted_material_name="spark_yellow"
gravity.y="0.0"
lifetime_min="5.5"
lifetime_max="25.5"
count_min="10"
count_max="20"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.max="256"
cosmetic_force_create="0"
airflow_force="0.5"
airflow_time="0.01"
airflow_scale="0.05"
attractor_force="2"
emission_interval_min_frames="1"
emission_interval_max_frames="1"
emit_cosmetic_particles="1"
is_emitting="1" >
</ParticleEmitterComponent>
<ParticleEmitterComponent
emitted_material_name="gold"
gravity.y="0.0"
lifetime_min="15.5"
lifetime_max="25.5"
count_min="1"
count_max="3"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.max="32"
cosmetic_force_create="0"
airflow_force="0.5"
airflow_time="0.01"
airflow_scale="0.05"
attractor_force="2"
emission_interval_min_frames="1"
emission_interval_max_frames="1"
emit_cosmetic_particles="1"
>
</ParticleEmitterComponent>
<VelocityComponent
gravity_y="0"
mass="0.1"
>
</VelocityComponent>
<HomingComponent
target_tag="prey"
homing_targeting_coeff="30"
detect_distance="800"
homing_velocity_multiplier="0.9"
>
</HomingComponent>
<ProjectileComponent
_enabled="1"
lob_min="1.0"
lob_max="1.0"
speed_min="80"
@ -65,51 +65,50 @@
friction="0"
direction_random_rad="0"
on_death_explode="0"
on_death_gfx_leave_sprite="0"
on_death_gfx_leave_sprite="0"
on_lifetime_out_explode="0"
explosion_dont_damage_shooter="1"
explosion_dont_damage_shooter="1"
on_collision_die="0"
lifetime="180"
damage="0"
velocity_sets_scale="0"
ragdoll_force_multiplier="0"
hit_particle_force_multiplier="0"
camera_shake_when_shot="0"
camera_shake_when_shot="0"
bounces_left="0"
muzzle_flash_file=""
muzzle_flash_file=""
shoot_light_flash_radius="1"
knockback_force="0"
>
knockback_force="0"
>
<config_explosion
never_cache="1"
camera_shake="0"
explosion_radius="0"
explosion_sprite=""
explosion_sprite_lifetime="0"
create_cell_probability="0"
never_cache="1"
camera_shake="0"
explosion_radius="0"
explosion_sprite=""
explosion_sprite_lifetime="0"
create_cell_probability="0"
hole_destroy_liquid="0"
explosion_sprite_emissive="0"
explosion_sprite_additive="0"
hole_enabled="0"
explosion_sprite_emissive="0"
explosion_sprite_additive="0"
hole_enabled="0"
ray_energy="0"
damage="0"
particle_effect="0"
particle_effect="0"
damage_mortals="0"
physics_explosion_power.min="0"
physics_explosion_power.min="0"
physics_explosion_power.max="0"
physics_throw_enabled="0"
shake_vegetation="0"
sparks_enabled="0"
stains_enabled="0"
physics_throw_enabled="0"
shake_vegetation="0"
sparks_enabled="0"
stains_enabled="0"
>
</config_explosion>
</ProjectileComponent>
<LuaComponent
execute_on_removed="1"
execute_every_n_frame="-1"
script_source_file="data/entities/animals/boss_centipede/ending/sampo_normal_ending.lua"
remove_after_executed="0">
</LuaComponent>
</Entity>
<LuaComponent
execute_on_removed="1"
execute_every_n_frame="-1"
script_source_file="data/entities/animals/boss_centipede/ending/sampo_normal_ending.lua"
remove_after_executed="0">
</LuaComponent>
</Entity>

View file

@ -9,12 +9,12 @@ local module = {}
ModLuaFileAppend("data/scripts/magic/fungal_shift.lua", "mods/quant.ew/files/system/fungal_shift/append/fungal_shift.lua")
local log_messages = {
"$log_reality_mutation_00",
"$log_reality_mutation_01",
"$log_reality_mutation_02",
"$log_reality_mutation_03",
"$log_reality_mutation_04",
"$log_reality_mutation_05",
"$log_reality_mutation_00",
"$log_reality_mutation_01",
"$log_reality_mutation_02",
"$log_reality_mutation_03",
"$log_reality_mutation_04",
"$log_reality_mutation_05",
}
-- TODO figure out what to do when player isn't online at the time of shifting
@ -29,7 +29,7 @@ function rpc.fungal_shift(conversions, iter, from_material_name)
for _, conv in ipairs(conversions) do
ConvertMaterialEverywhere(conv[1], conv[2])
GameCreateParticle( CellFactory_GetName(conv[1]), x-10, y-10, 20, rand(-100,100), rand(-100,-30), true, true )
GameCreateParticle( CellFactory_GetName(conv[1]), x+10, y-10, 20, rand(-100,100), rand(-100,-30), true, true )
GameCreateParticle( CellFactory_GetName(conv[1]), x+10, y-10, 20, rand(-100,100), rand(-100,-30), true, true )
end
-- remove tripping effect

View file

@ -2,29 +2,29 @@ dofile( "data/scripts/game_helpers.lua" )
function item_pickup( entity_item, entity_who_picked, name )
GlobalsSetValue("ew_heart_pickup", "fullhp")
local max_hp = 0
local healing = 0
local x, y = EntityGetTransform( entity_item )
local max_hp = 0
local healing = 0
local x, y = EntityGetTransform( entity_item )
local player_count = tonumber(GlobalsGetValue("ew_player_count", "1"))
local damagemodels = EntityGetComponent( entity_who_picked, "DamageModelComponent" )
if( damagemodels ~= nil ) then
for i,damagemodel in ipairs(damagemodels) do
max_hp = tonumber( ComponentGetValue( damagemodel, "max_hp" ) )
local hp = tonumber( ComponentGetValue( damagemodel, "hp" ) )
healing = math.min(max_hp - hp, max_hp / player_count)
-- ComponentSetValue( damagemodel, "hp", hp+healing)
end
end
local damagemodels = EntityGetComponent( entity_who_picked, "DamageModelComponent" )
if( damagemodels ~= nil ) then
for i,damagemodel in ipairs(damagemodels) do
max_hp = tonumber( ComponentGetValue( damagemodel, "max_hp" ) )
local hp = tonumber( ComponentGetValue( damagemodel, "hp" ) )
EntityLoad("data/entities/particles/image_emitters/heart_fullhp_effect.xml", x, y-12)
EntityLoad("data/entities/particles/heart_out.xml", x, y-8)
GamePrintImportant( "$log_heart_fullhp", GameTextGet( "$logdesc_heart_fullhp", tostring(math.floor(max_hp*25)), tostring(math.floor(healing*25)) ) )
healing = math.min(max_hp - hp, max_hp / player_count)
-- remove the item from the game
EntityKill( entity_item )
end
-- ComponentSetValue( damagemodel, "hp", hp+healing)
end
end
EntityLoad("data/entities/particles/image_emitters/heart_fullhp_effect.xml", x, y-12)
EntityLoad("data/entities/particles/heart_out.xml", x, y-8)
GamePrintImportant( "$log_heart_fullhp", GameTextGet( "$logdesc_heart_fullhp", tostring(math.floor(max_hp*25)), tostring(math.floor(healing*25)) ) )
-- remove the item from the game
EntityKill( entity_item )
end

View file

@ -3,40 +3,40 @@ dofile( "data/scripts/game_helpers.lua" )
function item_pickup( entity_item, entity_who_picked, name )
GlobalsSetValue("ew_heart_pickup", "temple")
local max_hp = 0
local max_hp_addition = 0.4
local healing = 0
local x, y = EntityGetTransform( entity_item )
local max_hp = 0
local max_hp_addition = 0.4
local healing = 0
local x, y = EntityGetTransform( entity_item )
local player_count = tonumber(GlobalsGetValue("ew_player_count", "1"))
local damagemodels = EntityGetComponent( entity_who_picked, "DamageModelComponent" )
if( damagemodels ~= nil ) then
for i,damagemodel in ipairs(damagemodels) do
max_hp = tonumber( ComponentGetValue( damagemodel, "max_hp" ) )
local max_hp_cap = tonumber( ComponentGetValue( damagemodel, "max_hp_cap" ) )
local hp = tonumber( ComponentGetValue( damagemodel, "hp" ) )
max_hp = max_hp + max_hp_addition
if ( max_hp_cap > 0 ) then
max_hp_cap = math.max( max_hp, max_hp_cap )
end
healing = math.min(max_hp - hp, max_hp / player_count)
-- if( hp > max_hp ) then hp = max_hp end
ComponentSetValue( damagemodel, "max_hp_cap", max_hp_cap)
ComponentSetValue( damagemodel, "max_hp", max_hp)
-- ComponentSetValue( damagemodel, "hp", hp+healing)
end
end
local damagemodels = EntityGetComponent( entity_who_picked, "DamageModelComponent" )
if( damagemodels ~= nil ) then
for i,damagemodel in ipairs(damagemodels) do
max_hp = tonumber( ComponentGetValue( damagemodel, "max_hp" ) )
local max_hp_cap = tonumber( ComponentGetValue( damagemodel, "max_hp_cap" ) )
local hp = tonumber( ComponentGetValue( damagemodel, "hp" ) )
EntityLoad("data/entities/particles/image_emitters/heart_fullhp_effect.xml", x, y-12)
EntityLoad("data/entities/particles/heart_out.xml", x, y-8)
GamePrintImportant( "$log_heart_fullhp_temple", GameTextGet( "$logdesc_heart_fullhp_temple", tostring(math.floor(max_hp_addition * 25)), tostring(math.floor(max_hp * 25)), tostring(math.floor(healing * 25)) ) )
--GameTriggerMusicEvent( "music/temple/enter", true, x, y )
max_hp = max_hp + max_hp_addition
-- remove the item from the game
EntityKill( entity_item )
end
if ( max_hp_cap > 0 ) then
max_hp_cap = math.max( max_hp, max_hp_cap )
end
healing = math.min(max_hp - hp, max_hp / player_count)
-- if( hp > max_hp ) then hp = max_hp end
ComponentSetValue( damagemodel, "max_hp_cap", max_hp_cap)
ComponentSetValue( damagemodel, "max_hp", max_hp)
-- ComponentSetValue( damagemodel, "hp", hp+healing)
end
end
EntityLoad("data/entities/particles/image_emitters/heart_fullhp_effect.xml", x, y-12)
EntityLoad("data/entities/particles/heart_out.xml", x, y-8)
GamePrintImportant( "$log_heart_fullhp_temple", GameTextGet( "$logdesc_heart_fullhp_temple", tostring(math.floor(max_hp_addition * 25)), tostring(math.floor(max_hp * 25)), tostring(math.floor(healing * 25)) ) )
--GameTriggerMusicEvent( "music/temple/enter", true, x, y )
-- remove the item from the game
EntityKill( entity_item )
end

View file

@ -53,8 +53,8 @@ local function heart_pickup(heart)
if max_hp ~= max_hp_old and heart == "evil" then
local entity_who_picked = peer_data.entity
local x_pos, y_pos = EntityGetTransform( entity_who_picked )
local child_id = EntityLoad("data/entities/misc/effect_poison_big.xml", x_pos, y_pos)
EntityAddChild(entity_who_picked, child_id)
local child_id = EntityLoad("data/entities/misc/effect_poison_big.xml", x_pos, y_pos)
EntityAddChild(entity_who_picked, child_id)
end
GamePrint("Player "..peer_data.name.." picked up a heart")

View file

@ -21,7 +21,7 @@ local shield_enabled = false
function shield_on()
local newgame_n = tonumber( SessionNumbersGetValue("NEW_GAME_PLUS_COUNT") )
local orbcount = GameGetOrbCountThisRun() + newgame_n
local orbcount = GameGetOrbCountThisRun() + newgame_n
if not shield_enabled then
CrossCall("ew_kolmi_shield", true, orbcount)
shield_enabled = true
@ -31,11 +31,10 @@ end
function shield_off()
local newgame_n = tonumber( SessionNumbersGetValue("NEW_GAME_PLUS_COUNT") )
local orbcount = GameGetOrbCountThisRun() + newgame_n
local orbcount = GameGetOrbCountThisRun() + newgame_n
if shield_enabled then
CrossCall("ew_kolmi_shield", false, orbcount)
shield_enabled = false
end
return old_shield_off()
end
end

View file

@ -20,7 +20,7 @@ function rpc.spawn_portal(x, y)
end
local function animate_sprite( current_name, next_name )
local kolmi = EntityGetClosestWithTag(0, 0, "boss_centipede")
local kolmi = EntityGetClosestWithTag(0, 0, "boss_centipede")
if kolmi ~= nil and kolmi ~= 0 then
GamePlayAnimation( kolmi, current_name, 0, next_name, 0 )
end
@ -128,7 +128,7 @@ ctx.cap.item_sync.register_pickup_handler(function(item_id)
async(function()
wait(10) -- Wait a bit for enemy sync to do it's thing.
local newgame_n = tonumber( SessionNumbersGetValue("NEW_GAME_PLUS_COUNT") )
local orbcount = GameGetOrbCountThisRun() + newgame_n
local orbcount = GameGetOrbCountThisRun() + newgame_n
rpc.kolmi_shield(true, orbcount)
rpc.init_boss(orbcount)
end)

View file

@ -1,32 +1,31 @@
<Entity>
<ParticleEmitterComponent
emitted_material_name="spark_green"
gravity.y="0.0"
lifetime_min="2"
lifetime_max="5"
count_min="4"
count_max="4"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.min="0"
area_circle_radius.max="0"
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"
image_animation_file="data/particles/image_emitters/animated_emitter_large.png"
image_animation_speed="3"
image_animation_loop="0"
is_emitting="1" >
</ParticleEmitterComponent>
<ParticleEmitterComponent
emitted_material_name="spark_green"
gravity.y="0.0"
lifetime_min="2"
lifetime_max="5"
count_min="4"
count_max="4"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.min="0"
area_circle_radius.max="0"
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"
image_animation_file="data/particles/image_emitters/animated_emitter_large.png"
image_animation_speed="3"
image_animation_loop="0"
is_emitting="1" >
</ParticleEmitterComponent>
<LifetimeComponent
lifetime="260" >
</LifetimeComponent>
</Entity>
<LifetimeComponent
lifetime="260" >
</LifetimeComponent>
</Entity>

View file

@ -155,8 +155,8 @@
critical_damage_resistance="1"
><damage_multipliers
explosion="0.35"
holy="1.5"
>
holy="1.5"
>
</damage_multipliers>
</DamageModelComponent>
@ -212,7 +212,7 @@
<SpriteComponent
_tags="character,lukki_enable"
_enabled="0"
_enabled="0"
alpha="1"
image_file="data/enemies_gfx/player_lukky.xml"
next_rect_animation=""
@ -312,7 +312,7 @@
only_pick_this_entity="52395832806"
></ItemPickUpperComponent>
<Base file="data/entities/base_jetpack_nosound.xml">
<Base file="data/entities/base_jetpack_nosound.xml">
<ParticleEmitterComponent
offset.x="-2"
@ -379,105 +379,105 @@
<KickComponent>
</KickComponent>
<VariableStorageComponent
name="ocarina_song"
value_string=""
></VariableStorageComponent>
<VariableStorageComponent
name="ocarina_song"
value_string=""
></VariableStorageComponent>
<VariableStorageComponent
name="kantele_song"
value_string=""
></VariableStorageComponent>
<VariableStorageComponent
name="kantele_song"
value_string=""
></VariableStorageComponent>
<VariableStorageComponent
name="ocarina_song_pos"
value_int="0"
></VariableStorageComponent>
<VariableStorageComponent
name="ocarina_song_pos"
value_int="0"
></VariableStorageComponent>
<VariableStorageComponent
name="kantele_song_pos"
value_int="0"
></VariableStorageComponent>
<VariableStorageComponent
name="kantele_song_pos"
value_int="0"
></VariableStorageComponent>
<SpriteComponent
_tags="character,player_amulet"
alpha="1"
image_file="data/enemies_gfx/player_amulet.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.59"
_enabled="0"
></SpriteComponent>
<SpriteComponent
_tags="character,player_amulet"
alpha="1"
image_file="data/enemies_gfx/player_amulet.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.59"
_enabled="0"
></SpriteComponent>
<SpriteComponent
_tags="character,player_amulet_gem"
alpha="1"
image_file="data/enemies_gfx/player_amulet_gem.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enabled="0"
></SpriteComponent>
<SpriteComponent
_tags="character,player_amulet_gem"
alpha="1"
image_file="data/enemies_gfx/player_amulet_gem.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enabled="0"
></SpriteComponent>
<SpriteComponent
_tags="character,player_hat"
alpha="1"
image_file="data/enemies_gfx/player_hat.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.59"
_enabled="0"
></SpriteComponent>
<SpriteComponent
_tags="character,player_hat"
alpha="1"
image_file="data/enemies_gfx/player_hat.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.59"
_enabled="0"
></SpriteComponent>
<SpriteComponent
_tags="character,player_hat2"
alpha="1"
image_file="data/enemies_gfx/player_hat2.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enabled="0"
></SpriteComponent>
<SpriteComponent
_tags="character,player_hat2"
alpha="1"
image_file="data/enemies_gfx/player_hat2.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enabled="0"
></SpriteComponent>
<!-- <SpriteComponent
_tags="character,player_hat2_shadow"
alpha="1"
image_file="data/enemies_gfx/player_hat2_shadow.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enabled="0"
></SpriteComponent>
<!-- <SpriteComponent
_tags="character,player_hat2_shadow"
alpha="1"
image_file="data/enemies_gfx/player_hat2_shadow.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enabled="0"
></SpriteComponent>
-->
<LuaComponent
script_source_file="data/scripts/magic/amulet.lua"
execute_on_added="1"
remove_after_executed="1"
>
</LuaComponent>
<LuaComponent
script_source_file="data/scripts/magic/amulet.lua"
execute_on_added="1"
remove_after_executed="1"
>
</LuaComponent>
<LuaComponent
script_source_file="data/scripts/magic/player_biome_check.lua"
execute_every_n_frame="80"
>
</LuaComponent>
<LuaComponent
script_source_file="data/scripts/magic/player_biome_check.lua"
execute_every_n_frame="80"
>
</LuaComponent>
<LuaComponent
script_source_file="data/scripts/magic/orb_map_init.lua"
execute_every_n_frame="10"
remove_after_executed="1"
>
</LuaComponent>
<LuaComponent
script_source_file="data/scripts/magic/orb_map_init.lua"
execute_every_n_frame="10"
remove_after_executed="1"
>
</LuaComponent>
<Entity>
<Base file="data/entities/misc/effect_no_heal_in_meat_biome.xml" >
@ -599,36 +599,36 @@
<InventoryGuiComponent/>
<SpriteComponent
_tags = "health_bar_back,ui,no_hitbox"
has_special_scale = "1"
image_file = "mods/quant.ew/files/resource/health_slider_back.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
alpha = "0.4"
z_index = "-9000"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<SpriteComponent
_tags = "health_bar_back,ui,no_hitbox"
has_special_scale = "1"
image_file = "mods/quant.ew/files/resource/health_slider_back.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
alpha = "0.4"
z_index = "-9000"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<SpriteComponent
_tags= "health_bar,ui,no_hitbox"
has_special_scale= "1"
image_file = "mods/quant.ew/files/resource/health_slider_front.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
z_index = "-9001"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<SpriteComponent
_tags= "health_bar,ui,no_hitbox"
has_special_scale= "1"
image_file = "mods/quant.ew/files/resource/health_slider_front.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
z_index = "-9001"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<BossHealthBarComponent
gui="0"
<BossHealthBarComponent
gui="0"
gui_max_distance_visible="1000000"
in_world="1">
</BossHealthBarComponent>
in_world="1">
</BossHealthBarComponent>
<StreamingKeepAliveComponent>
</StreamingKeepAliveComponent>

View file

@ -1,18 +1,18 @@
<Entity >
<VerletPhysicsComponent
num_points="150"
num_points="150"
width="10"
type="CLOTH"
stiffness="1.5"
velocity_dampening="0.55"
stiffness="1.5"
velocity_dampening="0.55"
resting_distance="1.0"
simulate_wind="1"
constrain_stretching="1"
collide_with_cells="1"
mass_min="0.1"
mass_max="0.2"
cloth_sprite_z_index="0.7"
constrain_stretching="1"
collide_with_cells="1"
mass_min="0.1"
mass_max="0.2"
cloth_sprite_z_index="0.7"
cloth_color="0xFFE72525"
cloth_color_edge="0xFF0B0F3F"
>
@ -20,6 +20,6 @@
<InheritTransformComponent
parent_hotspot_tag="cape_root" >
</InheritTransformComponent>
</InheritTransformComponent>
</Entity>

View file

@ -1,295 +1,295 @@
<Entity
tags="enemy,mortal,hittable,teleportable_NOT,boss_dragon,homing_target,glue_NOT,necrobot_NOT,polymorphable_NOT" name="$animal_boss_dragon">
<Entity
tags="enemy,mortal,hittable,teleportable_NOT,boss_dragon,homing_target,glue_NOT,necrobot_NOT,polymorphable_NOT" name="$animal_boss_dragon">
<_Transform
position.x="0"
position.y="0"
rotation="0"
scale.x="1"
scale.y="1" >
</_Transform>
<_Transform
position.x="0"
position.y="0"
rotation="0"
scale.x="1"
scale.y="1" >
</_Transform>
<BossDragonComponent
speed="3"
speed_hunt="4"
acceleration="0.25"
direction_adjust_speed="0.003"
direction_adjust_speed_hunt="0.04"
tail_gravity="30"
part_distance="16"
ground_check_offset="8"
eat_anim_wait_mult="0.15 "
hitbox_radius="9"
target_kill_radius="10"
target_kill_ragdoll_force="10"
hunt_box_radius="256"
random_target_box_radius="400"
new_hunt_target_check_every="240"
new_random_target_check_every="240"
ragdoll_filename="data/ragdolls/dragon/filenames.txt"
jump_cam_shake="20" >
</BossDragonComponent>
<BossDragonComponent
speed="3"
speed_hunt="4"
acceleration="0.25"
direction_adjust_speed="0.003"
direction_adjust_speed_hunt="0.04"
tail_gravity="30"
part_distance="16"
ground_check_offset="8"
eat_anim_wait_mult="0.15 "
hitbox_radius="9"
target_kill_radius="10"
target_kill_ragdoll_force="10"
hunt_box_radius="256"
random_target_box_radius="400"
new_hunt_target_check_every="240"
new_random_target_check_every="240"
ragdoll_filename="data/ragdolls/dragon/filenames.txt"
jump_cam_shake="20" >
</BossDragonComponent>
<CellEaterComponent
radius="9" >
</CellEaterComponent>
<CellEaterComponent
radius="9" >
</CellEaterComponent>
<DamageModelComponent
_enabled="1"
air_needed="0"
falling_damages="0"
fire_damage_amount="0"
fire_how_much_fire_generates="0"
fire_probability_of_ignition="0"
hp="120"
materials_damage="1"
materials_how_much_damage="0.1"
materials_that_damage="acid"
ragdoll_filenames_file=""
ragdoll_offset_y="-6"
>
<damage_multipliers
explosion="0.5"
fire="0.5"
ice="0.5"
electricity="0.3"
>
</damage_multipliers>
</DamageModelComponent>
<DamageModelComponent
_enabled="1"
air_needed="0"
falling_damages="0"
fire_damage_amount="0"
fire_how_much_fire_generates="0"
fire_probability_of_ignition="0"
hp="120"
materials_damage="1"
materials_how_much_damage="0.1"
materials_that_damage="acid"
ragdoll_filenames_file=""
ragdoll_offset_y="-6"
>
<damage_multipliers
explosion="0.5"
fire="0.5"
ice="0.5"
electricity="0.3"
>
</damage_multipliers>
</DamageModelComponent>
<PathFindingGridMarkerComponent
marker_offset_y="0"
marker_work_flag="16" >
</PathFindingGridMarkerComponent>
<PathFindingGridMarkerComponent
marker_offset_y="0"
marker_work_flag="16" >
</PathFindingGridMarkerComponent>
<GenomeDataComponent
_enabled="1"
herd_id="boss_dragon"
food_chain_rank="20"
is_predator="1" >
</GenomeDataComponent>
<GenomeDataComponent
_enabled="1"
herd_id="boss_dragon"
food_chain_rank="20"
is_predator="1" >
</GenomeDataComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_head.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_head.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_body.xml"
rect_animation="eat"
next_rect_animation="eat"
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_tail.xml"
rect_animation="eat"
next_rect_animation="eat"
next_rect_animation=""
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_enabled="1"
alpha="1"
image_file="data/enemies_gfx/dragon_tail.xml"
rect_animation="eat"
next_rect_animation="eat"
next_rect_animation=""
offset_x="17"
offset_y="15"
update_transform="0"
>
</SpriteComponent>
<SpriteComponent
_tags="health_bar_back,ui,no_hitbox"
_enabled="1"
alpha="1"
has_special_scale="1"
image_file="data/ui_gfx/health_slider_back.png"
is_text_sprite="0"
next_rect_animation=""
offset_x="12"
offset_y="42"
rect_animation=""
special_scale_x="1"
special_scale_y="1"
ui_is_parent="0"
update_transform="1"
visible="1"
emissive="1"
never_ragdollify_on_death="1"
z_index="-9000" >
</SpriteComponent>
<SpriteComponent
_tags="health_bar_back,ui,no_hitbox"
_enabled="1"
alpha="1"
has_special_scale="1"
image_file="data/ui_gfx/health_slider_back.png"
is_text_sprite="0"
next_rect_animation=""
offset_x="12"
offset_y="42"
rect_animation=""
special_scale_x="1"
special_scale_y="1"
ui_is_parent="0"
update_transform="1"
visible="1"
emissive="1"
never_ragdollify_on_death="1"
z_index="-9000" >
</SpriteComponent>
<SpriteComponent
_tags="health_bar,ui,no_hitbox"
_enabled="1"
alpha="1"
has_special_scale="1"
image_file="data/ui_gfx/health_slider_front.png"
is_text_sprite="0"
next_rect_animation=""
offset_x="11"
offset_y="42"
rect_animation=""
special_scale_x="1"
special_scale_y="1"
ui_is_parent="0"
update_transform="1"
visible="1"
emissive="1"
never_ragdollify_on_death="1"
z_index="-9000" >
</SpriteComponent>
<LightComponent
_enabled="1"
radius="100"
r="255"
g="149"
b="0" >
</LightComponent>
<SpriteComponent
_tags="health_bar,ui,no_hitbox"
_enabled="1"
alpha="1"
has_special_scale="1"
image_file="data/ui_gfx/health_slider_front.png"
is_text_sprite="0"
next_rect_animation=""
offset_x="11"
offset_y="42"
rect_animation=""
special_scale_x="1"
special_scale_y="1"
ui_is_parent="0"
update_transform="1"
visible="1"
emissive="1"
never_ragdollify_on_death="1"
z_index="-9000" >
</SpriteComponent>
<LightComponent
_enabled="1"
radius="100"
r="255"
g="149"
b="0" >
</LightComponent>
<HealthBarComponent>
</HealthBarComponent>
<HealthBarComponent>
</HealthBarComponent>
<MusicEnergyAffectorComponent
energy_target="1">
energy_target="1">
</MusicEnergyAffectorComponent>
<AudioLoopComponent
file="data/audio/Desktop/animals.bank"
event_name="animals/worm/movement_loop_big"
set_speed_parameter="1"
auto_play="1">
</AudioLoopComponent>
<Entity>
<InheritTransformComponent
parent_sprite_id="10"
>
</InheritTransformComponent>
<LuaComponent
script_source_file="data/scripts/projectiles/orb_green_dragon.lua"
execute_every_n_frame="80"
execute_times="-1"
>
</LuaComponent>
<GenomeDataComponent
_enabled="1"
herd_id="boss_dragon"
food_chain_rank="20"
is_predator="1" >
</GenomeDataComponent>
<AudioLoopComponent
file="data/audio/Desktop/animals.bank"
event_name="animals/worm/movement_loop_big"
set_speed_parameter="1"
auto_play="1">
</AudioLoopComponent>
<Entity>
<InheritTransformComponent
parent_sprite_id="10"
>
</InheritTransformComponent>
<LuaComponent
script_source_file="data/scripts/projectiles/orb_green_dragon.lua"
execute_every_n_frame="80"
execute_times="-1"
>
</LuaComponent>
<GenomeDataComponent
_enabled="1"
herd_id="boss_dragon"
food_chain_rank="20"
is_predator="1" >
</GenomeDataComponent>
</Entity>
</Entity>
<LuaComponent
script_death = "data/scripts/animals/boss_dragon_death.lua",
execute_every_n_frame = "-1",

View file

@ -5,10 +5,10 @@ function collision_trigger()
return
end
local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id )
EntityLoad( "mods/quant.ew/files/system/patch_dragon_boss/dragon_boss_extra.xml", pos_x, pos_y )
EntityLoad( "data/entities/particles/image_emitters/magical_symbol_fast.xml", pos_x, pos_y )
local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id )
EntityLoad( "mods/quant.ew/files/system/patch_dragon_boss/dragon_boss_extra.xml", pos_x, pos_y )
EntityLoad( "data/entities/particles/image_emitters/magical_symbol_fast.xml", pos_x, pos_y )
EntityKill( entity_id )
EntityKill( entity_id )
end

View file

@ -1,10 +1,10 @@
function biome_entered( new_biome_name, old_biome_name )
-- print( "new_biome_name: " .. new_biome_name )
local e = GetUpdatedEntityID()
-- print( "new_biome_name: " .. new_biome_name )
local e = GetUpdatedEntityID()
if( new_biome_name == "$biome_meat" ) then
EntityAddTag(e, "ew_no_heal_in_meat_biome")
else
EntityRemoveTag(e, "ew_no_heal_in_meat_biome")
end
end
if( new_biome_name == "$biome_meat" ) then
EntityAddTag(e, "ew_no_heal_in_meat_biome")
else
EntityRemoveTag(e, "ew_no_heal_in_meat_biome")
end
end

File diff suppressed because it is too large Load diff

View file

@ -155,8 +155,8 @@
critical_damage_resistance="1"
><damage_multipliers
explosion="0.35"
holy="1.5"
>
holy="1.5"
>
</damage_multipliers>
</DamageModelComponent>
@ -211,7 +211,7 @@
<SpriteComponent
_tags="character,lukki_enable"
_enabled="0"
_enabled="0"
alpha="1"
image_file="data/enemies_gfx/player_lukky.xml"
next_rect_animation=""
@ -305,7 +305,7 @@
only_pick_this_entity="52395832806"
></ItemPickUpperComponent>
<Base file="data/entities/base_jetpack_nosound.xml">
<Base file="data/entities/base_jetpack_nosound.xml">
<ParticleEmitterComponent
offset.x="-2"
@ -369,85 +369,85 @@
<KickComponent>
</KickComponent>
<VariableStorageComponent
name="ocarina_song"
value_string=""
></VariableStorageComponent>
<VariableStorageComponent
name="ocarina_song"
value_string=""
></VariableStorageComponent>
<VariableStorageComponent
name="kantele_song"
value_string=""
></VariableStorageComponent>
<VariableStorageComponent
name="kantele_song"
value_string=""
></VariableStorageComponent>
<VariableStorageComponent
name="ocarina_song_pos"
value_int="0"
></VariableStorageComponent>
<VariableStorageComponent
name="ocarina_song_pos"
value_int="0"
></VariableStorageComponent>
<VariableStorageComponent
name="kantele_song_pos"
value_int="0"
></VariableStorageComponent>
<VariableStorageComponent
name="kantele_song_pos"
value_int="0"
></VariableStorageComponent>
<SpriteComponent
_tags="character,player_amulet"
alpha="1"
MARKER_AMULET_ENABLED
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.59"
<SpriteComponent
_tags="character,player_amulet"
alpha="1"
MARKER_AMULET_ENABLED
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.59"
_enable="0"
></SpriteComponent>
></SpriteComponent>
<SpriteComponent
_tags="character,player_amulet_gem"
alpha="1"
<SpriteComponent
_tags="character,player_amulet_gem"
alpha="1"
MARKER_AMULET_GEM_ENABLED
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enable="0"
></SpriteComponent>
></SpriteComponent>
<SpriteComponent
_tags="character,player_hat"
alpha="1"
image_file="data/enemies_gfx/player_hat.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.59"
_enabled="0"
></SpriteComponent>
<SpriteComponent
_tags="character,player_hat"
alpha="1"
image_file="data/enemies_gfx/player_hat.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.59"
_enabled="0"
></SpriteComponent>
<SpriteComponent
_tags="character,player_hat2"
alpha="1"
<SpriteComponent
_tags="character,player_hat2"
alpha="1"
MARKER_HAT2_ENABLED
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enable="0"
></SpriteComponent>
></SpriteComponent>
<!-- <SpriteComponent
_tags="character,player_hat2_shadow"
alpha="1"
image_file="data/enemies_gfx/player_hat2_shadow.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enabled="MARKER_HAT2_ENABLED"
></SpriteComponent>
<!-- <SpriteComponent
_tags="character,player_hat2_shadow"
alpha="1"
image_file="data/enemies_gfx/player_hat2_shadow.xml"
next_rect_animation=""
offset_x="6"
offset_y="14"
rect_animation="walk"
z_index="0.58"
_enabled="MARKER_HAT2_ENABLED"
></SpriteComponent>
-->
<ParticleEmitterComponent
_tags="fast_movement_particles"
@ -559,35 +559,35 @@
value_string=""
/>
<SpriteComponent
_tags = "health_bar_back,ui,no_hitbox"
has_special_scale = "1"
image_file = "mods/quant.ew/files/resource/health_slider_back.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
alpha = "0.4"
z_index = "-9000"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<SpriteComponent
_tags = "health_bar_back,ui,no_hitbox"
has_special_scale = "1"
image_file = "mods/quant.ew/files/resource/health_slider_back.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
alpha = "0.4"
z_index = "-9000"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<SpriteComponent
_tags= "health_bar,ui,no_hitbox"
has_special_scale= "1"
image_file = "mods/quant.ew/files/resource/health_slider_front.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
z_index = "-9001"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<SpriteComponent
_tags= "health_bar,ui,no_hitbox"
has_special_scale= "1"
image_file = "mods/quant.ew/files/resource/health_slider_front.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
z_index = "-9001"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<BossHealthBarComponent
gui="0"
in_world="1">
</BossHealthBarComponent>
<BossHealthBarComponent
gui="0"
in_world="1">
</BossHealthBarComponent>
<!-- <Entity name="chunk_loader">
<Base file="mods/quant.ew/files/resource/entities/chunk_loader.xml">

View file

@ -1,17 +1,17 @@
<Entity name="cape">
<VerletPhysicsComponent
num_points="150"
num_points="150"
width="10"
type="CLOTH"
stiffness="1.5"
velocity_dampening="0.55"
stiffness="1.5"
velocity_dampening="0.55"
resting_distance="1.0"
simulate_wind="1"
constrain_stretching="1"
collide_with_cells="1"
mass_min="0.1"
mass_max="0.2"
constrain_stretching="1"
collide_with_cells="1"
mass_min="0.1"
mass_max="0.2"
cloth_sprite_z_index="0.7"
>
@ -21,4 +21,4 @@
parent_hotspot_tag="cape_root" >
</InheritTransformComponent>
</Entity>
</Entity>

View file

@ -1,32 +1,32 @@
<Entity>
<InheritTransformComponent
only_position="1"
>
<Transform
position.x="0"
position.y="-8" >
</Transform>
</InheritTransformComponent>
<ParticleEmitterComponent
emitted_material_name="spark_yellow"
gravity.y="0.0"
lifetime_min="0.1"
lifetime_max="0.5"
count_min="200"
count_max="300"
render_on_grid="0"
<InheritTransformComponent
only_position="1"
>
<Transform
position.x="0"
position.y="-8" >
</Transform>
</InheritTransformComponent>
<ParticleEmitterComponent
emitted_material_name="spark_yellow"
gravity.y="0.0"
lifetime_min="0.1"
lifetime_max="0.5"
count_min="200"
count_max="300"
render_on_grid="0"
render_ultrabright="1"
fade_based_on_lifetime="1"
area_circle_radius.min="100"
area_circle_radius.max="100"
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>
fade_based_on_lifetime="1"
area_circle_radius.min="100"
area_circle_radius.max="100"
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>
</Entity>

View file

@ -1,10 +1,10 @@
<Entity name="spectator_shield">
<Entity name="spectator_shield">
<HitboxComponent
<HitboxComponent
_tags="enabled_in_world"
aabb_min_x="-4"
aabb_max_x="4"
aabb_min_y="-3"
aabb_min_x="-4"
aabb_max_x="4"
aabb_min_y="-3"
aabb_max_y="3"
></HitboxComponent>
@ -13,79 +13,79 @@
use_root_parent="1"
only_position="1"
>
<Transform
position.x="0"
<Transform
position.x="0"
position.y="-4" >
</Transform>
</InheritTransformComponent>
<ParticleEmitterComponent
_tags="character,enabled_in_hand"
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="50"
_tags="character,enabled_in_hand"
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="50"
area_circle_sector_degrees="30"
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>
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="40"
count_max="50"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.min="50"
area_circle_radius.max="50"
<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="40"
count_max="50"
render_on_grid="1"
fade_based_on_lifetime="1"
area_circle_radius.min="50"
area_circle_radius.max="50"
area_circle_sector_degrees="30"
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>
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,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="50"
area_circle_radius.max="50"
<ParticleEmitterComponent
_tags="character,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="50"
area_circle_radius.max="50"
area_circle_sector_degrees="30"
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>
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>
<AudioComponent
_tags="enabled_in_hand,item_identified"
@ -93,12 +93,12 @@
event_root="player_projectiles/shield"
set_latest_event_position="1" >
</AudioComponent>
<EnergyShieldComponent
recharge_speed="0.1"
<EnergyShieldComponent
recharge_speed="0.1"
energy_required_to_shield="0.5"
radius="50.0"
radius="50.0"
sector_degrees="30"
>
>
</EnergyShieldComponent>
</Entity>

View file

@ -1,8 +1,8 @@
function get_players()
return EntityGetWithTag("ew_peer")
return EntityGetWithTag("ew_peer")
end
function _streaming_run_event(id)
CrossCall("ew_run_streaming_event", id)
end
end

View file

@ -10,22 +10,22 @@ rpc.opts_reliable()
rpc.opts_everywhere()
function rpc.remote_run_event(id)
for i,evt in ipairs(streaming_events) do
if evt.id == id then
if evt.action_delayed ~= nil then
if evt.delay_timer ~= nil then
if evt.id == id then
if evt.action_delayed ~= nil then
if evt.delay_timer ~= nil then
local p = ctx.my_player.entity
add_timer_above_head( p, evt.id, evt.delay_timer )
end
elseif evt.action ~= nil then
evt.action(evt)
end
end
elseif evt.action ~= nil then
evt.action(evt)
end
if event_weights ~= nil then
event_weights[i] = -1.0
end
GamePrint("Incoming event "..GameTextGetTranslatedOrNot(evt.ui_name).." from "..ctx.rpc_player_data.name)
break
end
end
break
end
end
end
np.CrossCallAdd("ew_run_streaming_event", rpc.remote_run_event)

View file

@ -396,7 +396,7 @@ function register_localizations(translation_file, clear_count)
end
function OnModPreInit()
register_localizations("mods/quant.ew/translations.csv", 1)
register_localizations("mods/quant.ew/translations.csv", 1)
ctx.init()
net.init()

View file

@ -1,18 +1,18 @@
<Mod
name="Quant's Entangled worlds"
description="Yet another Noita multiplayer mod"
request_no_api_restrictions="1"
is_game_mode="0"
translation_xml_path=""
translation_csv_path=""
>
name="Quant's Entangled worlds"
description="Yet another Noita multiplayer mod"
request_no_api_restrictions="1"
is_game_mode="0"
translation_xml_path=""
translation_csv_path=""
>
</Mod>
<!--
April 1 2021 - a mod declared as game mode (is_game_mode="1") can enable support for multiple save slots via game_mode_supports_save_slots="1"
-->
<!--
If a mod requires access to the full lua api e.g. os.* io.* it has to request acesss via 'request_no_api_restrictions="1"'.
It is recommended that other options are explored first, as we may completely disable those APIs in the future.
By default mods have access to the table, string, math and bit libraries and to the APIs exposed by the game.
April 1 2021 - a mod declared as game mode (is_game_mode="1") can enable support for multiple save slots via game_mode_supports_save_slots="1"
-->
<!--
If a mod requires access to the full lua api e.g. os.* io.* it has to request acesss via 'request_no_api_restrictions="1"'.
It is recommended that other options are explored first, as we may completely disable those APIs in the future.
By default mods have access to the table, string, math and bit libraries and to the APIs exposed by the game.
-->

View file

@ -1,11 +1,11 @@
local function early_init()
if #ModLuaFileGetAppends("mods/quant.ew/files/core/early_init.lua") == 0 then
-- Use appends to store data
ModLuaFileAppend("mods/quant.ew/files/core/early_init.lua", "data/scripts/empty.lua")
-- Early init stuff, called before main "mod" is loaded. Meaning we can append to data/scripts/init.lua
dofile("mods/quant.ew/files/core/early_init.lua")
end
if #ModLuaFileGetAppends("mods/quant.ew/files/core/early_init.lua") == 0 then
-- Use appends to store data
ModLuaFileAppend("mods/quant.ew/files/core/early_init.lua", "data/scripts/empty.lua")
-- Early init stuff, called before main "mod" is loaded. Meaning we can append to data/scripts/init.lua
dofile("mods/quant.ew/files/core/early_init.lua")
end
end
@ -24,7 +24,7 @@ dofile("data/scripts/lib/mod_settings.lua") -- see this file for documentation o
-- ModSettingSetNextValue() will set the buffered value, that will later become visible via ModSettingGet(), unless the setting scope is MOD_SETTING_SCOPE_RUNTIME.
function mod_setting_change_callback( mod_id, gui, in_main_menu, setting, old_value, new_value )
print( tostring(new_value) )
print( tostring(new_value) )
end
local mod_id = "quant.ew" -- This should match the name of your mod's folder.
@ -35,17 +35,17 @@ mod_settings =
-- This function is called to ensure the correct setting values are visible to the game via ModSettingGet(). your mod's settings don't work if you don't have a function like this defined in settings.lua.
-- This function is called:
-- - when entering the mod settings menu (init_scope will be MOD_SETTINGS_SCOPE_ONLY_SET_DEFAULT)
-- - before mod initialization when starting a new game (init_scope will be MOD_SETTING_SCOPE_NEW_GAME)
-- - when entering the game after a restart (init_scope will be MOD_SETTING_SCOPE_RESTART)
-- - at the end of an update when mod settings have been changed via ModSettingsSetNextValue() and the game is unpaused (init_scope will be MOD_SETTINGS_SCOPE_RUNTIME)
-- - when entering the mod settings menu (init_scope will be MOD_SETTINGS_SCOPE_ONLY_SET_DEFAULT)
-- - before mod initialization when starting a new game (init_scope will be MOD_SETTING_SCOPE_NEW_GAME)
-- - when entering the game after a restart (init_scope will be MOD_SETTING_SCOPE_RESTART)
-- - at the end of an update when mod settings have been changed via ModSettingsSetNextValue() and the game is unpaused (init_scope will be MOD_SETTINGS_SCOPE_RUNTIME)
function ModSettingsUpdate( init_scope )
--local old_version = mod_settings_get_version( mod_id ) -- This can be used to migrate some settings between mod versions.
mod_settings_update( mod_id, mod_settings, init_scope )
if ModIsEnabled(mod_id) then
print("Running early init fn")
early_init()
end
--local old_version = mod_settings_get_version( mod_id ) -- This can be used to migrate some settings between mod versions.
mod_settings_update( mod_id, mod_settings, init_scope )
if ModIsEnabled(mod_id) then
print("Running early init fn")
early_init()
end
end
-- This function should return the number of visible setting UI elements.
@ -55,10 +55,10 @@ end
-- At the moment it is fine to simply return 0 or 1 in a custom implementation, but we don't guarantee that will be the case in the future.
-- This function is called every frame when in the settings menu.
function ModSettingsGuiCount()
return mod_settings_gui_count( mod_id, mod_settings )
return mod_settings_gui_count( mod_id, mod_settings )
end
-- This function is called to display the settings UI for this mod. Your mod's settings wont be visible in the mod settings menu if this function isn't defined correctly.
function ModSettingsGui( gui, in_main_menu )
mod_settings_gui( mod_id, mod_settings, gui, in_main_menu )
mod_settings_gui( mod_id, mod_settings, gui, in_main_menu )
end