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 <Mod
version_built_with="12" version_built_with="12"
> >
</Mod> </Mod>

View file

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

View file

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

View file

@ -12,17 +12,17 @@ local pos_x, pos_y = EntityGetFirstHitboxCenter( entity_id )
local enemy, enemy_x, enemy_y local enemy, enemy_x, enemy_y
local min_dist = 9999 local min_dist = 9999
for _,id in pairs(EntityGetInRadiusWithTag(pos_x, pos_y, range, "mortal")) do for _,id in pairs(EntityGetInRadiusWithTag(pos_x, pos_y, range, "mortal")) do
-- is target a valid enemy -- is target a valid enemy
if EntityGetComponent(id, "GenomeDataComponent") ~= nil and EntityGetComponent(root_id, "GenomeDataComponent") ~= nil and EntityGetHerdRelation(root_id, id) < 40 then if EntityGetComponent(id, "GenomeDataComponent") ~= nil and EntityGetComponent(root_id, "GenomeDataComponent") ~= nil and EntityGetHerdRelation(root_id, id) < 40 then
local x, y = EntityGetFirstHitboxCenter( id ) local x, y = EntityGetFirstHitboxCenter( id )
local dist = get_distance(pos_x, pos_y, x, y) local dist = get_distance(pos_x, pos_y, x, y)
if dist < min_dist then if dist < min_dist then
min_dist = dist min_dist = dist
enemy = id enemy = id
enemy_x = x enemy_x = x
enemy_y = y enemy_y = y
end end
end end
end end
-- check los -- check los
@ -31,29 +31,29 @@ if enemy then can_shoot = not RaytraceSurfacesAndLiquiform(pos_x, pos_y, enemy_x
-- hand/shooting state & animation control -- hand/shooting state & animation control
edit_component2( entity_id, "SpriteComponent", function(comp,vars) edit_component2( entity_id, "SpriteComponent", function(comp,vars)
-- if enemy is not visible then open hand -- if enemy is not visible then open hand
local hand_check = ComponentGetValue2( comp, "rect_animation" ) local hand_check = ComponentGetValue2( comp, "rect_animation" )
local hand_open = false local hand_open = false
if ( hand_check ~= nil ) and ( hand_check == "open" ) then if ( hand_check ~= nil ) and ( hand_check == "open" ) then
hand_open = true hand_open = true
end end
if not can_shoot then if not can_shoot then
if not hand_open then if not hand_open then
ComponentSetValue2( comp, "rect_animation", "open") ComponentSetValue2( comp, "rect_animation", "open")
--EntitySetComponentsWithTagEnabled( entity_id, "enabled_when_attacking", false ) --EntitySetComponentsWithTagEnabled( entity_id, "enabled_when_attacking", false )
end end
return return
end end
-- prepare to shoot -- prepare to shoot
if hand_open then if hand_open then
ComponentSetValue2( comp, "rect_animation", "close") ComponentSetValue2( comp, "rect_animation", "close")
--EntitySetComponentsWithTagEnabled( entity_id, "enabled_when_attacking", true ) --EntitySetComponentsWithTagEnabled( entity_id, "enabled_when_attacking", true )
can_shoot = false can_shoot = false
return return
end end
end) end)
if not can_shoot then return 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" ) dofile_once("data/scripts/biomes/temple_shared.lua" )
function collision_trigger() function collision_trigger()
local entity_id = GetUpdatedEntityID() local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id ) local pos_x, pos_y = EntityGetTransform( entity_id )
-- this reset the biome stats - see workshop_trigger_check_stats.lua -- this reset the biome stats - see workshop_trigger_check_stats.lua
StatsBiomeReset() StatsBiomeReset()
EntityLoad("data/entities/particles/image_emitters/magical_symbol.xml", pos_x - 144, pos_y + 82 - 12 ) 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_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-143, pos_y+47)
--EntityLoad("data/entities/misc/workshop_areadamage.xml", pos_x-543, 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" ) local workshop_1 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_1 ); EntityKill( workshop_1 );
--print("Destroyed workshop entity 2") --print("Destroyed workshop entity 2")
local workshop_2 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" ) local workshop_2 = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2 ); EntityKill( workshop_2 );
--print("Destroyed workshop entity 2") --print("Destroyed workshop entity 2")
local workshop_2b = EntityGetClosestWithTag( pos_x, pos_y, "workshop" ) local workshop_2b = EntityGetClosestWithTag( pos_x, pos_y, "workshop" )
EntityKill( workshop_2b ); EntityKill( workshop_2b );
--print("Destroyed workshop entity 2b") --print("Destroyed workshop entity 2b")
local workshop_3 = EntityGetClosestWithTag( pos_x, pos_y, "workshop_show_hint" ) local workshop_3 = EntityGetClosestWithTag( pos_x, pos_y, "workshop_show_hint" )
EntityKill( workshop_3 ); EntityKill( workshop_3 );
--print("Destroyed workshop hint entity") --print("Destroyed workshop hint entity")
-- kill temple_areacheckers that are on (about) the same horizontal level as we are -- 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" ) local temple_areacheckers = EntityGetInRadiusWithTag( pos_x, pos_y, 2048, "temple_areachecker" )
for k,areachecker in pairs(temple_areacheckers) do for k,areachecker in pairs(temple_areacheckers) do
local area_x, area_y = EntityGetTransform( areachecker ) local area_x, area_y = EntityGetTransform( areachecker )
if( math.abs( pos_y - area_y ) < 512 ) then if( math.abs( pos_y - area_y ) < 512 ) then
EntityKill( areachecker ) EntityKill( areachecker )
end end
end end
-- SetGlobalValue( "temple_collapsed_" ) -- SetGlobalValue( "temple_collapsed_" )
-- tags="temple_areachecker" -- tags="temple_areachecker"
local collapse_name = "TEMPLE_COLLAPSED_" .. temple_pos_to_id( pos_x, pos_y ) local collapse_name = "TEMPLE_COLLAPSED_" .. temple_pos_to_id( pos_x, pos_y )
GlobalsSetValue( collapse_name, "1" ) 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 ) GameTriggerMusicFadeOutAndDequeueAll( 2.0 )
GamePlaySound( "data/audio/Desktop/misc.bank", "misc/temple_collapse", pos_x-112, pos_y + 40 ) GamePlaySound( "data/audio/Desktop/misc.bank", "misc/temple_collapse", pos_x-112, pos_y + 40 )
end end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,63 +1,63 @@
<Entity name="unknown" > <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 <ParticleEmitterComponent
_enabled="1" 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_min="1.0"
lob_max="1.0" lob_max="1.0"
speed_min="80" speed_min="80"
@ -65,51 +65,50 @@
friction="0" friction="0"
direction_random_rad="0" direction_random_rad="0"
on_death_explode="0" on_death_explode="0"
on_death_gfx_leave_sprite="0" on_death_gfx_leave_sprite="0"
on_lifetime_out_explode="0" on_lifetime_out_explode="0"
explosion_dont_damage_shooter="1" explosion_dont_damage_shooter="1"
on_collision_die="0" on_collision_die="0"
lifetime="180" lifetime="180"
damage="0" damage="0"
velocity_sets_scale="0" velocity_sets_scale="0"
ragdoll_force_multiplier="0" ragdoll_force_multiplier="0"
hit_particle_force_multiplier="0" hit_particle_force_multiplier="0"
camera_shake_when_shot="0" camera_shake_when_shot="0"
bounces_left="0" bounces_left="0"
muzzle_flash_file="" muzzle_flash_file=""
shoot_light_flash_radius="1" shoot_light_flash_radius="1"
knockback_force="0" knockback_force="0"
> >
<config_explosion <config_explosion
never_cache="1" never_cache="1"
camera_shake="0" camera_shake="0"
explosion_radius="0" explosion_radius="0"
explosion_sprite="" explosion_sprite=""
explosion_sprite_lifetime="0" explosion_sprite_lifetime="0"
create_cell_probability="0" create_cell_probability="0"
hole_destroy_liquid="0" hole_destroy_liquid="0"
explosion_sprite_emissive="0" explosion_sprite_emissive="0"
explosion_sprite_additive="0" explosion_sprite_additive="0"
hole_enabled="0" hole_enabled="0"
ray_energy="0" ray_energy="0"
damage="0" damage="0"
particle_effect="0" particle_effect="0"
damage_mortals="0" damage_mortals="0"
physics_explosion_power.min="0" physics_explosion_power.min="0"
physics_explosion_power.max="0" physics_explosion_power.max="0"
physics_throw_enabled="0" physics_throw_enabled="0"
shake_vegetation="0" shake_vegetation="0"
sparks_enabled="0" sparks_enabled="0"
stains_enabled="0" stains_enabled="0"
> >
</config_explosion> </config_explosion>
</ProjectileComponent> </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") ModLuaFileAppend("data/scripts/magic/fungal_shift.lua", "mods/quant.ew/files/system/fungal_shift/append/fungal_shift.lua")
local log_messages = { local log_messages = {
"$log_reality_mutation_00", "$log_reality_mutation_00",
"$log_reality_mutation_01", "$log_reality_mutation_01",
"$log_reality_mutation_02", "$log_reality_mutation_02",
"$log_reality_mutation_03", "$log_reality_mutation_03",
"$log_reality_mutation_04", "$log_reality_mutation_04",
"$log_reality_mutation_05", "$log_reality_mutation_05",
} }
-- TODO figure out what to do when player isn't online at the time of shifting -- 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 for _, conv in ipairs(conversions) do
ConvertMaterialEverywhere(conv[1], conv[2]) 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 ) GameCreateParticle( CellFactory_GetName(conv[1]), x+10, y-10, 20, rand(-100,100), rand(-100,-30), true, true )
end end
-- remove tripping effect -- remove tripping effect

View file

@ -2,29 +2,29 @@ dofile( "data/scripts/game_helpers.lua" )
function item_pickup( entity_item, entity_who_picked, name ) function item_pickup( entity_item, entity_who_picked, name )
GlobalsSetValue("ew_heart_pickup", "fullhp") GlobalsSetValue("ew_heart_pickup", "fullhp")
local max_hp = 0 local max_hp = 0
local healing = 0 local healing = 0
local x, y = EntityGetTransform( entity_item ) local x, y = EntityGetTransform( entity_item )
local player_count = tonumber(GlobalsGetValue("ew_player_count", "1")) local player_count = tonumber(GlobalsGetValue("ew_player_count", "1"))
local damagemodels = EntityGetComponent( entity_who_picked, "DamageModelComponent" ) local damagemodels = EntityGetComponent( entity_who_picked, "DamageModelComponent" )
if( damagemodels ~= nil ) then if( damagemodels ~= nil ) then
for i,damagemodel in ipairs(damagemodels) do for i,damagemodel in ipairs(damagemodels) do
max_hp = tonumber( ComponentGetValue( damagemodel, "max_hp" ) ) max_hp = tonumber( ComponentGetValue( damagemodel, "max_hp" ) )
local hp = tonumber( ComponentGetValue( damagemodel, "hp" ) ) local hp = tonumber( ComponentGetValue( damagemodel, "hp" ) )
healing = math.min(max_hp - hp, max_hp / player_count)
-- ComponentSetValue( damagemodel, "hp", hp+healing)
end
end
EntityLoad("data/entities/particles/image_emitters/heart_fullhp_effect.xml", x, y-12) healing = math.min(max_hp - hp, max_hp / player_count)
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 -- ComponentSetValue( damagemodel, "hp", hp+healing)
EntityKill( entity_item ) end
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 ) function item_pickup( entity_item, entity_who_picked, name )
GlobalsSetValue("ew_heart_pickup", "temple") GlobalsSetValue("ew_heart_pickup", "temple")
local max_hp = 0 local max_hp = 0
local max_hp_addition = 0.4 local max_hp_addition = 0.4
local healing = 0 local healing = 0
local x, y = EntityGetTransform( entity_item ) local x, y = EntityGetTransform( entity_item )
local player_count = tonumber(GlobalsGetValue("ew_player_count", "1")) local player_count = tonumber(GlobalsGetValue("ew_player_count", "1"))
local damagemodels = EntityGetComponent( entity_who_picked, "DamageModelComponent" ) local damagemodels = EntityGetComponent( entity_who_picked, "DamageModelComponent" )
if( damagemodels ~= nil ) then if( damagemodels ~= nil ) then
for i,damagemodel in ipairs(damagemodels) do for i,damagemodel in ipairs(damagemodels) do
max_hp = tonumber( ComponentGetValue( damagemodel, "max_hp" ) ) max_hp = tonumber( ComponentGetValue( damagemodel, "max_hp" ) )
local max_hp_cap = tonumber( ComponentGetValue( damagemodel, "max_hp_cap" ) ) local max_hp_cap = tonumber( ComponentGetValue( damagemodel, "max_hp_cap" ) )
local hp = tonumber( ComponentGetValue( damagemodel, "hp" ) ) 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
EntityLoad("data/entities/particles/image_emitters/heart_fullhp_effect.xml", x, y-12) max_hp = max_hp + max_hp_addition
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 if ( max_hp_cap > 0 ) then
EntityKill( entity_item ) max_hp_cap = math.max( max_hp, max_hp_cap )
end 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 if max_hp ~= max_hp_old and heart == "evil" then
local entity_who_picked = peer_data.entity local entity_who_picked = peer_data.entity
local x_pos, y_pos = EntityGetTransform( entity_who_picked ) local x_pos, y_pos = EntityGetTransform( entity_who_picked )
local child_id = EntityLoad("data/entities/misc/effect_poison_big.xml", x_pos, y_pos) local child_id = EntityLoad("data/entities/misc/effect_poison_big.xml", x_pos, y_pos)
EntityAddChild(entity_who_picked, child_id) EntityAddChild(entity_who_picked, child_id)
end end
GamePrint("Player "..peer_data.name.." picked up a heart") GamePrint("Player "..peer_data.name.." picked up a heart")

View file

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

View file

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

View file

@ -1,32 +1,31 @@
<Entity> <Entity>
<ParticleEmitterComponent <ParticleEmitterComponent
emitted_material_name="spark_green" emitted_material_name="spark_green"
gravity.y="0.0" gravity.y="0.0"
lifetime_min="2" lifetime_min="2"
lifetime_max="5" lifetime_max="5"
count_min="4" count_min="4"
count_max="4" count_max="4"
render_on_grid="1" render_on_grid="1"
fade_based_on_lifetime="1" fade_based_on_lifetime="1"
area_circle_radius.min="0" area_circle_radius.min="0"
area_circle_radius.max="0" area_circle_radius.max="0"
cosmetic_force_create="0" cosmetic_force_create="0"
airflow_force="0.251" airflow_force="0.251"
airflow_time="1.01" airflow_time="1.01"
airflow_scale="0.05" airflow_scale="0.05"
emission_interval_min_frames="1" emission_interval_min_frames="1"
emission_interval_max_frames="1" emission_interval_max_frames="1"
emit_cosmetic_particles="1" emit_cosmetic_particles="1"
image_animation_file="data/particles/image_emitters/animated_emitter_large.png" image_animation_file="data/particles/image_emitters/animated_emitter_large.png"
image_animation_speed="3" image_animation_speed="3"
image_animation_loop="0" image_animation_loop="0"
is_emitting="1" > is_emitting="1" >
</ParticleEmitterComponent> </ParticleEmitterComponent>
<LifetimeComponent <LifetimeComponent
lifetime="260" > lifetime="260" >
</LifetimeComponent> </LifetimeComponent>
</Entity>
</Entity>

View file

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

View file

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

View file

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

View file

@ -5,10 +5,10 @@ function collision_trigger()
return return
end end
local entity_id = GetUpdatedEntityID() local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id ) 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( "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 ) EntityLoad( "data/entities/particles/image_emitters/magical_symbol_fast.xml", pos_x, pos_y )
EntityKill( entity_id ) EntityKill( entity_id )
end end

View file

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

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

@ -1,32 +1,32 @@
<Entity> <Entity>
<InheritTransformComponent <InheritTransformComponent
only_position="1" only_position="1"
> >
<Transform <Transform
position.x="0" position.x="0"
position.y="-8" > position.y="-8" >
</Transform> </Transform>
</InheritTransformComponent> </InheritTransformComponent>
<ParticleEmitterComponent <ParticleEmitterComponent
emitted_material_name="spark_yellow" emitted_material_name="spark_yellow"
gravity.y="0.0" gravity.y="0.0"
lifetime_min="0.1" lifetime_min="0.1"
lifetime_max="0.5" lifetime_max="0.5"
count_min="200" count_min="200"
count_max="300" count_max="300"
render_on_grid="0" render_on_grid="0"
render_ultrabright="1" render_ultrabright="1"
fade_based_on_lifetime="1" fade_based_on_lifetime="1"
area_circle_radius.min="100" area_circle_radius.min="100"
area_circle_radius.max="100" area_circle_radius.max="100"
cosmetic_force_create="0" cosmetic_force_create="0"
airflow_force="0.3" airflow_force="0.3"
airflow_time="0.01" airflow_time="0.01"
airflow_scale="0.05" airflow_scale="0.05"
emission_interval_min_frames="0" emission_interval_min_frames="0"
emission_interval_max_frames="0" emission_interval_max_frames="0"
emit_cosmetic_particles="1" emit_cosmetic_particles="1"
is_emitting="1" > is_emitting="1" >
</ParticleEmitterComponent> </ParticleEmitterComponent>
</Entity> </Entity>

View file

@ -1,10 +1,10 @@
<Entity name="spectator_shield"> <Entity name="spectator_shield">
<HitboxComponent <HitboxComponent
_tags="enabled_in_world" _tags="enabled_in_world"
aabb_min_x="-4" aabb_min_x="-4"
aabb_max_x="4" aabb_max_x="4"
aabb_min_y="-3" aabb_min_y="-3"
aabb_max_y="3" aabb_max_y="3"
></HitboxComponent> ></HitboxComponent>
@ -13,79 +13,79 @@
use_root_parent="1" use_root_parent="1"
only_position="1" only_position="1"
> >
<Transform <Transform
position.x="0" position.x="0"
position.y="-4" > position.y="-4" >
</Transform> </Transform>
</InheritTransformComponent> </InheritTransformComponent>
<ParticleEmitterComponent <ParticleEmitterComponent
_tags="character,enabled_in_hand" _tags="character,enabled_in_hand"
emitted_material_name="plasma_fading" emitted_material_name="plasma_fading"
gravity.y="0.0" gravity.y="0.0"
lifetime_min="0.1" lifetime_min="0.1"
lifetime_max="0.5" lifetime_max="0.5"
count_min="2" count_min="2"
count_max="4" count_max="4"
render_on_grid="1" render_on_grid="1"
fade_based_on_lifetime="1" fade_based_on_lifetime="1"
area_circle_radius.max="50" area_circle_radius.max="50"
area_circle_sector_degrees="30" area_circle_sector_degrees="30"
cosmetic_force_create="0" cosmetic_force_create="0"
airflow_force="0.5" airflow_force="0.5"
airflow_time="0.1" airflow_time="0.1"
airflow_scale="0.5" airflow_scale="0.5"
emission_interval_min_frames="1" emission_interval_min_frames="1"
emission_interval_max_frames="1" emission_interval_max_frames="1"
emit_cosmetic_particles="1" emit_cosmetic_particles="1"
is_emitting="1" > is_emitting="1" >
</ParticleEmitterComponent> </ParticleEmitterComponent>
<ParticleEmitterComponent <ParticleEmitterComponent
_tags="character,enabled_in_hand,item_identified__LEGACY,shield_ring" _tags="character,enabled_in_hand,item_identified__LEGACY,shield_ring"
emitted_material_name="plasma_fading" emitted_material_name="plasma_fading"
gravity.y="0.0" gravity.y="0.0"
lifetime_min="0.02" lifetime_min="0.02"
lifetime_max="0.05" lifetime_max="0.05"
count_min="40" count_min="40"
count_max="50" count_max="50"
render_on_grid="1" render_on_grid="1"
fade_based_on_lifetime="1" fade_based_on_lifetime="1"
area_circle_radius.min="50" area_circle_radius.min="50"
area_circle_radius.max="50" area_circle_radius.max="50"
area_circle_sector_degrees="30" area_circle_sector_degrees="30"
cosmetic_force_create="0" cosmetic_force_create="0"
airflow_force="0.3" airflow_force="0.3"
airflow_time="0.01" airflow_time="0.01"
airflow_scale="0.05" airflow_scale="0.05"
emission_interval_min_frames="0" emission_interval_min_frames="0"
emission_interval_max_frames="0" emission_interval_max_frames="0"
emit_cosmetic_particles="1" emit_cosmetic_particles="1"
is_emitting="1" > is_emitting="1" >
</ParticleEmitterComponent> </ParticleEmitterComponent>
<ParticleEmitterComponent <ParticleEmitterComponent
_tags="character,shield_hit" _tags="character,shield_hit"
emitted_material_name="plasma_fading" emitted_material_name="plasma_fading"
gravity.y="0.0" gravity.y="0.0"
lifetime_min="0.3" lifetime_min="0.3"
lifetime_max="1" lifetime_max="1"
count_min="300" count_min="300"
count_max="360" count_max="360"
render_on_grid="1" render_on_grid="1"
fade_based_on_lifetime="1" fade_based_on_lifetime="1"
area_circle_radius.min="50" area_circle_radius.min="50"
area_circle_radius.max="50" area_circle_radius.max="50"
area_circle_sector_degrees="30" area_circle_sector_degrees="30"
cosmetic_force_create="0" cosmetic_force_create="0"
airflow_force="2.8" airflow_force="2.8"
airflow_time="0.03" airflow_time="0.03"
airflow_scale="0.8" airflow_scale="0.8"
emission_interval_min_frames="0" emission_interval_min_frames="0"
emission_interval_max_frames="0" emission_interval_max_frames="0"
emit_cosmetic_particles="1" emit_cosmetic_particles="1"
is_emitting="0" > is_emitting="0" >
</ParticleEmitterComponent> </ParticleEmitterComponent>
<AudioComponent <AudioComponent
_tags="enabled_in_hand,item_identified" _tags="enabled_in_hand,item_identified"
@ -93,12 +93,12 @@
event_root="player_projectiles/shield" event_root="player_projectiles/shield"
set_latest_event_position="1" > set_latest_event_position="1" >
</AudioComponent> </AudioComponent>
<EnergyShieldComponent <EnergyShieldComponent
recharge_speed="0.1" recharge_speed="0.1"
energy_required_to_shield="0.5" energy_required_to_shield="0.5"
radius="50.0" radius="50.0"
sector_degrees="30" sector_degrees="30"
> >
</EnergyShieldComponent> </EnergyShieldComponent>
</Entity> </Entity>

View file

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

View file

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

View file

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

View file

@ -1,18 +1,18 @@
<Mod <Mod
name="Quant's Entangled worlds" name="Quant's Entangled worlds"
description="Yet another Noita multiplayer mod" description="Yet another Noita multiplayer mod"
request_no_api_restrictions="1" request_no_api_restrictions="1"
is_game_mode="0" is_game_mode="0"
translation_xml_path="" translation_xml_path=""
translation_csv_path="" translation_csv_path=""
> >
</Mod> </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" 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.
--> -->
<!--
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() local function early_init()
if #ModLuaFileGetAppends("mods/quant.ew/files/core/early_init.lua") == 0 then if #ModLuaFileGetAppends("mods/quant.ew/files/core/early_init.lua") == 0 then
-- Use appends to store data -- Use appends to store data
ModLuaFileAppend("mods/quant.ew/files/core/early_init.lua", "data/scripts/empty.lua") 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 -- 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") dofile("mods/quant.ew/files/core/early_init.lua")
end end
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. -- 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 ) 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 end
local mod_id = "quant.ew" -- This should match the name of your mod's folder. 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 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: -- This function is called:
-- - when entering the mod settings menu (init_scope will be MOD_SETTINGS_SCOPE_ONLY_SET_DEFAULT) -- - 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) -- - 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) -- - 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) -- - 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 ) function ModSettingsUpdate( init_scope )
--local old_version = mod_settings_get_version( mod_id ) -- This can be used to migrate some settings between mod versions. --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 ) mod_settings_update( mod_id, mod_settings, init_scope )
if ModIsEnabled(mod_id) then if ModIsEnabled(mod_id) then
print("Running early init fn") print("Running early init fn")
early_init() early_init()
end end
end end
-- This function should return the number of visible setting UI elements. -- 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. -- 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. -- This function is called every frame when in the settings menu.
function ModSettingsGuiCount() function ModSettingsGuiCount()
return mod_settings_gui_count( mod_id, mod_settings ) return mod_settings_gui_count( mod_id, mod_settings )
end 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. -- 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 ) 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 end