mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-18 17:17:31 +00:00
Implement spiral movement
Also: - Disable polymorphing, teleportation - Decrease camera smoothing - Disable infuence of the mouse on the camera - Disable parallax effect - Add some useful effects to player - Increase player HP
This commit is contained in:
parent
5af54b9289
commit
9b52f9e410
2
.vscode/settings.json
vendored
Normal file
2
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 David Vogel
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -0,0 +1,5 @@
|
|||||||
|
// Copyright (c) 2019 David Vogel
|
||||||
|
//
|
||||||
|
// This software is released under the MIT License.
|
||||||
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
7
data/entities/misc/effect_polymorph.xml
Normal file
7
data/entities/misc/effect_polymorph.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Entity>
|
||||||
|
<InheritTransformComponent>
|
||||||
|
</InheritTransformComponent>
|
||||||
|
|
||||||
|
<GameEffectComponent >
|
||||||
|
</GameEffectComponent >
|
||||||
|
</Entity>
|
7
data/entities/misc/effect_polymorph_random.xml
Normal file
7
data/entities/misc/effect_polymorph_random.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Entity>
|
||||||
|
<InheritTransformComponent>
|
||||||
|
</InheritTransformComponent>
|
||||||
|
|
||||||
|
<GameEffectComponent >
|
||||||
|
</GameEffectComponent >
|
||||||
|
</Entity>
|
7
data/entities/misc/effect_teleportation.xml
Normal file
7
data/entities/misc/effect_teleportation.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Entity>
|
||||||
|
<InheritTransformComponent>
|
||||||
|
</InheritTransformComponent>
|
||||||
|
|
||||||
|
<GameEffectComponent >
|
||||||
|
</GameEffectComponent >
|
||||||
|
</Entity>
|
7
data/entities/misc/effect_teleportation_enemy.xml
Normal file
7
data/entities/misc/effect_teleportation_enemy.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Entity>
|
||||||
|
<InheritTransformComponent>
|
||||||
|
</InheritTransformComponent>
|
||||||
|
|
||||||
|
<GameEffectComponent >
|
||||||
|
</GameEffectComponent >
|
||||||
|
</Entity>
|
7
data/entities/misc/effect_teleportitis.xml
Normal file
7
data/entities/misc/effect_teleportitis.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Entity>
|
||||||
|
<InheritTransformComponent>
|
||||||
|
</InheritTransformComponent>
|
||||||
|
|
||||||
|
<GameEffectComponent >
|
||||||
|
</GameEffectComponent >
|
||||||
|
</Entity>
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
@ -1,17 +0,0 @@
|
|||||||
table.insert( actions,
|
|
||||||
{
|
|
||||||
id = "SEA_OF_SWAMP",
|
|
||||||
name = "Sea of swamp",
|
|
||||||
description = "How useful",
|
|
||||||
sprite = "mods/example/files/actions/sea_swamp.png",
|
|
||||||
type = ACTION_TYPE_MATERIAL,
|
|
||||||
spawn_level = "0,4,5,6", -- BERSERK_FIELD
|
|
||||||
spawn_probability = "1,1,1,1", -- BERSERK_FIELD
|
|
||||||
price = 350,
|
|
||||||
mana = 140,
|
|
||||||
max_uses = 3,
|
|
||||||
action = function()
|
|
||||||
add_projectile("mods/example/files/actions/sea_swamp.xml")
|
|
||||||
c.fire_rate_wait = c.fire_rate_wait + 15
|
|
||||||
end,
|
|
||||||
} )
|
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
@ -1,56 +0,0 @@
|
|||||||
<Entity name="$projectile_default">
|
|
||||||
|
|
||||||
<MaterialSeaSpawnerComponent
|
|
||||||
size.x="300"
|
|
||||||
size.y="256"
|
|
||||||
offset.x="0"
|
|
||||||
offset.y="158"
|
|
||||||
speed="10"
|
|
||||||
noise_threshold="0.0"
|
|
||||||
material="water_swamp" >
|
|
||||||
</MaterialSeaSpawnerComponent>
|
|
||||||
|
|
||||||
<LifetimeComponent
|
|
||||||
lifetime="300">
|
|
||||||
</LifetimeComponent>
|
|
||||||
|
|
||||||
<ParticleEmitterComponent
|
|
||||||
emitted_material_name="water_swamp"
|
|
||||||
gravity.y="0.0"
|
|
||||||
lifetime_min="6"
|
|
||||||
lifetime_max="8"
|
|
||||||
count_min="8"
|
|
||||||
count_max="8"
|
|
||||||
render_on_grid="1"
|
|
||||||
fade_based_on_lifetime="1"
|
|
||||||
area_circle_radius.min="0"
|
|
||||||
area_circle_radius.max="0"
|
|
||||||
cosmetic_force_create="0"
|
|
||||||
airflow_force="0.51"
|
|
||||||
airflow_time="1.01"
|
|
||||||
airflow_scale="0.05"
|
|
||||||
x_pos_offset_min="0"
|
|
||||||
x_pos_offset_max="0"
|
|
||||||
y_pos_offset_min="0"
|
|
||||||
y_pos_offset_max="0"
|
|
||||||
emission_interval_min_frames="1"
|
|
||||||
emission_interval_max_frames="1"
|
|
||||||
emit_cosmetic_particles="1"
|
|
||||||
image_animation_file="data/particles/image_emitters/sea_oil.png"
|
|
||||||
image_animation_speed="5"
|
|
||||||
image_animation_loop="0"
|
|
||||||
is_emitting="1" >
|
|
||||||
</ParticleEmitterComponent>
|
|
||||||
|
|
||||||
<MusicEnergyAffectorComponent
|
|
||||||
energy_target="1">
|
|
||||||
</MusicEnergyAffectorComponent>
|
|
||||||
|
|
||||||
<AudioComponent
|
|
||||||
file="data/audio/Desktop/projectiles.snd"
|
|
||||||
event_root="player_projectiles/sea_of_oil"
|
|
||||||
set_latest_event_position="1" >
|
|
||||||
</AudioComponent>
|
|
||||||
|
|
||||||
</Entity>
|
|
||||||
|
|
157
files/capture.lua
Normal file
157
files/capture.lua
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
-- Copyright (c) 2019 David Vogel
|
||||||
|
--
|
||||||
|
-- This software is released under the MIT License.
|
||||||
|
-- https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
|
dofile("data/scripts/lib/coroutines.lua")
|
||||||
|
--dofile("data/scripts/lib/utilities.lua")
|
||||||
|
dofile("data/scripts/perks/perk_list.lua")
|
||||||
|
|
||||||
|
local CAPTURE_GRID_SIZE = 64 -- in ingame pixels
|
||||||
|
local CAPTURE_DELAY = 30 -- in frames
|
||||||
|
local CAPTURE_FORCE_HP = 40 -- * 25HP
|
||||||
|
|
||||||
|
local function getPlayer()
|
||||||
|
local players = EntityGetWithTag("player_unit")
|
||||||
|
if players == nil or #players < 1 then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return players[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
local function getPlayerPos()
|
||||||
|
return EntityGetTransform(getPlayer())
|
||||||
|
end
|
||||||
|
|
||||||
|
local function teleportPlayer(x, y)
|
||||||
|
EntitySetTransform(getPlayer(), x, y)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function setPlayerHP(hp)
|
||||||
|
local damagemodels = EntityGetComponent(getPlayer(), "DamageModelComponent")
|
||||||
|
|
||||||
|
if damagemodels ~= nil then
|
||||||
|
for i, damagemodel in ipairs(damagemodels) do
|
||||||
|
ComponentSetValue(damagemodel, "max_hp", hp)
|
||||||
|
ComponentSetValue(damagemodel, "hp", hp)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function addEffectToEntity(entity, gameEffect)
|
||||||
|
local gameEffectComp = GetGameEffectLoadTo(entity, gameEffect, true)
|
||||||
|
if gameEffectComp ~= nil then
|
||||||
|
ComponentSetValue(gameEffectComp, "frames", "-1")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function addPerkToPlayer(perkID)
|
||||||
|
local playerEntity = getPlayer()
|
||||||
|
local x, y = getPlayerPos()
|
||||||
|
local perkData = get_perk_with_id(perk_list, perkID)
|
||||||
|
|
||||||
|
-- Add effect
|
||||||
|
addEffectToEntity(playerEntity, perkData.game_effect)
|
||||||
|
|
||||||
|
-- Add ui icon etc
|
||||||
|
local perkIcon = EntityCreateNew("")
|
||||||
|
EntityAddComponent(
|
||||||
|
perkIcon,
|
||||||
|
"UIIconComponent",
|
||||||
|
{
|
||||||
|
name = perkData.ui_name,
|
||||||
|
description = perkData.ui_description,
|
||||||
|
icon_sprite_file = perkData.ui_icon
|
||||||
|
}
|
||||||
|
)
|
||||||
|
EntityAddChild(playerEntity, perkIcon)
|
||||||
|
|
||||||
|
--local effect = EntityLoad("data/entities/misc/effect_protection_all.xml", x, y)
|
||||||
|
--EntityAddChild(playerEntity, effect)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function preparePlayer()
|
||||||
|
local playerEntity = getPlayer()
|
||||||
|
addEffectToEntity(playerEntity, "PROTECTION_ALL")
|
||||||
|
|
||||||
|
addPerkToPlayer("BREATH_UNDERWATER")
|
||||||
|
addPerkToPlayer("INVISIBILITY")
|
||||||
|
addPerkToPlayer("REMOVE_FOG_OF_WAR")
|
||||||
|
addPerkToPlayer("REPELLING_CAPE")
|
||||||
|
addPerkToPlayer("WORM_DETRACTOR")
|
||||||
|
|
||||||
|
setPlayerHP(CAPTURE_FORCE_HP)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function resetPlayer()
|
||||||
|
setPlayerHP(CAPTURE_FORCE_HP)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function doCapture()
|
||||||
|
local ox, oy = getPlayerPos()
|
||||||
|
local x, y = ox, oy
|
||||||
|
|
||||||
|
preparePlayer()
|
||||||
|
|
||||||
|
-- Coroutine to force player to x, y coordinate
|
||||||
|
async_loop(
|
||||||
|
function()
|
||||||
|
teleportPlayer(x, y)
|
||||||
|
resetPlayer()
|
||||||
|
wait(0)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Coroutine to calculate next coordinate, and trigger screenshots
|
||||||
|
local i = 1
|
||||||
|
async_loop(
|
||||||
|
function()
|
||||||
|
-- +x
|
||||||
|
for i = 1, i, 1 do
|
||||||
|
x, y = x + CAPTURE_GRID_SIZE, y
|
||||||
|
wait(CAPTURE_DELAY)
|
||||||
|
end
|
||||||
|
-- +y
|
||||||
|
for i = 1, i, 1 do
|
||||||
|
x, y = x, y + CAPTURE_GRID_SIZE
|
||||||
|
wait(CAPTURE_DELAY)
|
||||||
|
end
|
||||||
|
i = i + 1
|
||||||
|
-- -x
|
||||||
|
for i = 1, i, 1 do
|
||||||
|
x, y = x - CAPTURE_GRID_SIZE, y
|
||||||
|
wait(CAPTURE_DELAY)
|
||||||
|
end
|
||||||
|
-- -y
|
||||||
|
for i = 1, i, 1 do
|
||||||
|
x, y = x, y - CAPTURE_GRID_SIZE
|
||||||
|
wait(CAPTURE_DELAY)
|
||||||
|
end
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- #### UI ####
|
||||||
|
|
||||||
|
local gui = GuiCreate()
|
||||||
|
|
||||||
|
async_loop(
|
||||||
|
function()
|
||||||
|
if gui ~= nil then
|
||||||
|
GuiStartFrame(gui)
|
||||||
|
|
||||||
|
GuiLayoutBeginVertical(gui, 50, 20)
|
||||||
|
if GuiButton(gui, 0, 0, "Start capturing map", 1) then
|
||||||
|
doCapture()
|
||||||
|
GuiDestroy(gui)
|
||||||
|
gui = nil
|
||||||
|
end
|
||||||
|
GuiTextCentered(gui, 0, 0, "Don't do anything while the capturing process is running!")
|
||||||
|
GuiTextCentered(gui, 0, 0, "Use ESC and close the game to stop the process.")
|
||||||
|
GuiLayoutEnd(gui)
|
||||||
|
end
|
||||||
|
|
||||||
|
wait(0)
|
||||||
|
end
|
||||||
|
)
|
@ -1,5 +1,7 @@
|
|||||||
<MagicNumbers
|
<MagicNumbers VIRTUAL_RESOLUTION_X="427"
|
||||||
VIRTUAL_RESOLUTION_X="427"
|
VIRTUAL_RESOLUTION_Y="242"
|
||||||
VIRTUAL_RESOLUTION_Y="242"
|
CAMERA_NO_MOVE_BUFFER_NEAR_VIEWPORT_EDGE="0.0"
|
||||||
> <!-- some magic number defaults could be overridden here -->
|
CAMERA_MOUSE_INTERPOLATION_SPEED="0.0"
|
||||||
|
CAMERA_POSITION_INTERPOLATION_SPEED="50.0"
|
||||||
|
DRAW_PARALLAX_BACKGROUND="0">
|
||||||
</MagicNumbers>
|
</MagicNumbers>
|
||||||
|
15
init.lua
15
init.lua
@ -1,21 +1,18 @@
|
|||||||
function OnModPreInit()
|
function OnModPreInit()
|
||||||
print("Mod - OnModPreInit()") -- first this is called for all mods
|
-- print("Mod - OnModPreInit()") -- first this is called for all mods
|
||||||
end
|
end
|
||||||
|
|
||||||
function OnModInit()
|
function OnModInit()
|
||||||
print("Mod - OnModInit()") -- after that this is called for all mods
|
-- print("Mod - OnModInit()") -- after that this is called for all mods
|
||||||
end
|
end
|
||||||
|
|
||||||
function OnModPostInit()
|
function OnModPostInit()
|
||||||
print("Mod - OnModPostInit()") -- then this is called for all mods
|
-- print("Mod - OnModPostInit()") -- then this is called for all mods
|
||||||
end
|
end
|
||||||
|
|
||||||
function OnPlayerSpawned( player_entity ) -- this
|
function OnPlayerSpawned(player_entity)
|
||||||
GamePrint( "Mods says: Player entity id: " .. tostring(player_entity) )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- this code runs when all mods' filesystems are registered
|
-- this code runs when all mods' filesystems are registered
|
||||||
ModLuaFileAppend( "data/scripts/gun/gun_actions.lua", "mods/example/files/actions.lua" ) -- basically dofile("mods/example/files/actions.lua") will appear at the end of gun_actions.lua
|
ModLuaFileAppend("data/scripts/director_init.lua", "mods/capture-all/files/capture.lua")
|
||||||
ModMagicNumbersFileAdd( "mods/example/files/magic_numbers.xml" ) -- will override some magic numbers using the specified file
|
ModMagicNumbersFileAdd("mods/capture-all/files/magic_numbers.xml") -- override some game constants
|
||||||
print("Example mod init done")
|
|
||||||
|
Loading…
Reference in New Issue
Block a user