Skip to content

Commit

Permalink
feat: gallery_punchを実装した
Browse files Browse the repository at this point in the history
  • Loading branch information
den3606 committed Nov 29, 2022
1 parent c3a5777 commit 1d39d9a
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 11 deletions.
74 changes: 74 additions & 0 deletions files/entities/projectiles/gallery_punch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<Entity name="$projectile_default"
tags="projectile_player">

<Base file="data/entities/base_projectile.xml">
<VelocityComponent air_friction="-0.4"
mass="0.65">
</VelocityComponent>
</Base>

<ProjectileComponent _enabled="1"
lob_min="0.8"
lob_max="1.1"
speed_min="10000"
speed_max="10000"
direction_random_rad="0.003"
on_death_explode="1"
on_death_gfx_leave_sprite="0"
on_lifetime_out_explode="1"
die_on_low_velocity="1"
explosion_dont_damage_shooter="1"
on_collision_die="1"
ragdoll_force_multiplier="0.03"
lifetime="300"
ground_penetration_coeff="6"
velocity_sets_scale="1"
camera_shake_when_shot="0"
shoot_light_flash_radius="0"
hit_particle_force_multiplier="0.1"
create_shell_casing="0"
bounces_left="0"
collide_with_shooter_frames="0"
friendly_fire="1"
damage="0.04"
muzzle_flash_file=""
knockback_force="0.7">
<config_explosion never_cache="1"
damage="0"
camera_shake="0"
explosion_radius="0.5"
explosion_sprite="data/particles/explosion_016_plasma.xml"
explosion_sprite_lifetime="0"
create_cell_probability="0"
hole_destroy_liquid="0"
hole_enabled="1"
hole_image="data/temp/explosion_hole.png"
explosion_sprite_additive="1"
ray_energy="0"
particle_effect="0"
physics_explosion_power.min="0"
physics_explosion_power.max="0"
physics_throw_enabled="0"
shake_vegetation="1"
sparks_count_min="0"
sparks_count_max="0"
sparks_enabled="0"
light_enabled="0"
stains_enabled="1"
stains_radius="1">
</config_explosion>
</ProjectileComponent>

<AudioComponent
file="data/audio/Desktop/projectiles.bank"
event_root="player_projectiles/bomb">
</AudioComponent>

<AudioLoopComponent
file="data/audio/Desktop/projectiles.bank"
event_name="projectiles/fuse_burn_slow"
auto_play="1">
</AudioLoopComponent>

</Entity>

16 changes: 16 additions & 0 deletions files/scripts/events/gallery_punch.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
local function GralleryPunch(data, event)
local EventHelper = dofile_once("mods/twitch-point-integration/files/scripts/event_helper.lua")

local player_entity_id = GetPlayerEntity()
if player_entity_id == nil then
return false
end

local x, y = EntityGetTransform(GetPlayerEntity())
SetRandomSeed(x + GameGetFrameNum(), y + GameGetFrameNum())
local direction = ({-1, 1})[Random(1, 2)]
EventHelper.ShootProjectile(GetPlayerEntity(), "mods/twitch-point-integration/files/entities/projectiles/gallery_punch.xml", x, y, direction * 300, -200)
return true
end

return GralleryPunch
6 changes: 6 additions & 0 deletions files/scripts/noita_event_observer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ local events = {
twitchCost = 800,
weight = 100,
},
GralleryPunch = {
action = dofile_once("mods/twitch-point-integration/files/scripts/events/gallery_punch.lua"),
name = "GralleryPunch",
twitchCost = 20,
weight = 100,
},
Healing = {
action = dofile_once("mods/twitch-point-integration/files/scripts/events/healing.lua"),
name = "Healing",
Expand Down
20 changes: 10 additions & 10 deletions files/scripts/status_effects/bomberman.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ if (player_entity_id == nil) then
end

local x, y = EntityGetTransform(player_entity_id)
local entity_id = EntityLoad( "mods/twitch-point-integration/files/entities/bomberman.xml", x, y )
local entity_id = EntityLoad("mods/twitch-point-integration/files/entities/bomberman.xml", x, y)

edit_component( entity_id, "ProjectileComponent", function(comp,vars)
local herd_id = get_herd_id( player_entity_id )
vars.mWhoShot = player_entity_id
vars.mShooterHerdId = herd_id
end)
edit_component( entity_id, "VelocityComponent", function(comp,vars)
ComponentSetValueVector2( comp, "mVelocity", 0, 0 )
end)
GameShootProjectile( player_entity_id, x, y, x, y, entity_id, true )
edit_component(entity_id, "ProjectileComponent", function(comp, vars)
local herd_id = get_herd_id(player_entity_id)
vars.mWhoShot = player_entity_id
vars.mShooterHerdId = herd_id
end)
edit_component(entity_id, "VelocityComponent", function(comp, vars)
ComponentSetValueVector2(comp, "mVelocity", 0, 0)
end)
GameShootProjectile(player_entity_id, x, y, x, y, entity_id, true)
3 changes: 2 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ local function noita_event_debug()
-- Lume.push(NOITA_TASKS, {event_name = "Blindness", event_data = { used_by = 'noita', message = 'testMessage' }})
-- Lume.push(NOITA_TASKS, {event_name = "Bomberman", event_data = { used_by = 'noita', message = 'testMessage' }})
-- Lume.push(NOITA_TASKS, {event_name = "FungalShift", event_data = { used_by = 'noita', message = 'testMessage' }})
Lume.push(NOITA_TASKS, {event_name = "GralleryPunch", event_data = { used_by = 'noita', message = 'testMessage' }})
-- Lume.push(NOITA_TASKS, {event_name = "Healing", event_data = { used_by = 'noita', message = 'testMessage' }})
-- Lume.push(NOITA_TASKS, {event_name = "HeavySpread", event_data = { used_by = 'noita', message = 'testMessage' }})
-- Lume.push(NOITA_TASKS, {event_name = "HelloDeer", event_data = { used_by = 'noita', message = 'testMessage' }})
Expand Down Expand Up @@ -101,7 +102,7 @@ local function noita_event_debug()
end

-- Coil.add(function() Coil.wait(180) add_events() end) -- once
-- Coil.add(function() while true do Coil.wait(180) add_events() end end) -- Loop
Coil.add(function() while true do Coil.wait(180) add_events() end end) -- Loop
end

function OnPlayerSpawned(player_entity_id)
Expand Down

0 comments on commit 1d39d9a

Please sign in to comment.