From 9b52f9e410ec0e5a30cb628d1b4c06a29f108d41 Mon Sep 17 00:00:00 2001 From: David Vogel Date: Fri, 18 Oct 2019 22:35:51 +0200 Subject: [PATCH] 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 --- .vscode/settings.json | 2 + LICENSE | 21 +++ ...ere will override the game's default files | 5 + data/entities/misc/effect_polymorph.xml | 7 + .../entities/misc/effect_polymorph_random.xml | 7 + data/entities/misc/effect_teleportation.xml | 7 + .../misc/effect_teleportation_enemy.xml | 7 + data/entities/misc/effect_teleportitis.xml | 7 + data/items_gfx/handgun.png | Bin 17345 -> 0 bytes files/actions.lua | 17 -- files/actions/sea_swamp.png | Bin 17842 -> 0 bytes files/actions/sea_swamp.xml | 56 ------- files/capture.lua | 157 ++++++++++++++++++ files/magic_numbers.xml | 10 +- init.lua | 15 +- mod.xml | 6 +- 16 files changed, 234 insertions(+), 90 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 LICENSE create mode 100644 data/entities/misc/effect_polymorph.xml create mode 100644 data/entities/misc/effect_polymorph_random.xml create mode 100644 data/entities/misc/effect_teleportation.xml create mode 100644 data/entities/misc/effect_teleportation_enemy.xml create mode 100644 data/entities/misc/effect_teleportitis.xml delete mode 100644 data/items_gfx/handgun.png delete mode 100644 files/actions.lua delete mode 100644 files/actions/sea_swamp.png delete mode 100644 files/actions/sea_swamp.xml create mode 100644 files/capture.lua diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2fe6872 --- /dev/null +++ b/LICENSE @@ -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. \ No newline at end of file diff --git a/data/any files here will override the game's default files b/data/any files here will override the game's default files index e69de29..075585f 100644 --- a/data/any files here will override the game's default files +++ b/data/any files here will override the game's default files @@ -0,0 +1,5 @@ +// Copyright (c) 2019 David Vogel +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + diff --git a/data/entities/misc/effect_polymorph.xml b/data/entities/misc/effect_polymorph.xml new file mode 100644 index 0000000..a067306 --- /dev/null +++ b/data/entities/misc/effect_polymorph.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/data/entities/misc/effect_polymorph_random.xml b/data/entities/misc/effect_polymorph_random.xml new file mode 100644 index 0000000..a067306 --- /dev/null +++ b/data/entities/misc/effect_polymorph_random.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/data/entities/misc/effect_teleportation.xml b/data/entities/misc/effect_teleportation.xml new file mode 100644 index 0000000..a067306 --- /dev/null +++ b/data/entities/misc/effect_teleportation.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/data/entities/misc/effect_teleportation_enemy.xml b/data/entities/misc/effect_teleportation_enemy.xml new file mode 100644 index 0000000..a067306 --- /dev/null +++ b/data/entities/misc/effect_teleportation_enemy.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/data/entities/misc/effect_teleportitis.xml b/data/entities/misc/effect_teleportitis.xml new file mode 100644 index 0000000..0209bc0 --- /dev/null +++ b/data/entities/misc/effect_teleportitis.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/data/items_gfx/handgun.png b/data/items_gfx/handgun.png deleted file mode 100644 index 354c357edaeb253c37ee73490d92a4d66813ca7a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17345 zcmeI3cUTkI`o{-BdQ&MP;)Wt3l15Jqp@b?;APCq)5<;XTB+&pW3nEQi5K(Eug09k0 zK~V%05J9C0t_@IDiilqDw;&6v0(U6F=(?MGf6x6hd7flm&V0Y`IrDkXIn4Yqaa)~i zq{P>V0{|dpXKU#S9;LyrsHiabdw)f1Gk6eV+Iq18Kw{PGR{%&qyBYw*o#_O^)~&t_ z4ukE>V8ZMO1Q?UW@S*!t0U)?D(~U-S8&WWtc=^G?J~sT6J;POA6y|CXA1;@qsjVs| zyCqgN=efK~?FuU^A?177v4RN+;m74&bR>_7KNIO!J(m!9KK9syPp=N1_j^(`@w#RD z+Ee^s(O70#n@EkQng zUylKv!2y(=hmS3A`8rV3Dl1V6h)Mz|m)NL{fY3o;?>%+(VBlyPAZI=5f%|<^iR_>@ zNGh!qSD}Hiir66v4-)b4K&;bhwNuOpH={@kbw}ofayuJIT2igjmW&rSt6V^VhgDhJUzF9atVEWwp5h35*650DF z;(bbG%&r01L!BOD%vm;8IVUQfKOgAtf3~IGVh8Dg$Kh#O-JTkcDgQsiaGxi}f4kMI z5uv*)!bWKFx4PyJ4j0z8ofJFj-TgYz=JR!lna?VZ)avcLD?GL3`dn59C0M2(AJe^{ z7H4sCHN6u6Fj~o|{Z&g;Fx)rt zRU3Eaz3G%q_Ie=P$L?eh0PMEZKoB34nKp_7fMs@s_GNSB54EdxYJ}I;F7K|D_`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<-g05HOHt z%Ymw{V7QiG@n1D?$D~5vp9v>8z6wW|X~NCiNdAqsLbr<0T`GF)HuZr2mv}xfuLKtihf(r&jyeYvYo)63` z!36^%-jv`H&j;p};DP}WZ%S~9=L7RfaKV6xH^t&o7=Q5-42ItJ6hW_b`q`WML9c`& z7>=H<01!4003x>nz{erz*a-j|FaYpsE%Y{N3IJ$w_pG^U5A{9iWNS?gX*}Y!NTmv) zw8>tZA6=VYK6|>SipPAfllRR91r;A~w)Qfq5!(zigWmM*nz|?Dbfi-{3fSXFz!SsX zeDsXh55>~Don0LX4SsdmGl6aT_q(hCBZnv%^#JMDUSDo;OMI8(>#H(P&N{SlPO7G= zrFl9vzF}>G$0_SP_qt8>3E@vS^cyf1N_V|ET^PE#+y-5Q``avDxB|Z+(e}urf;BJx iZv61N`;CY!3;eTS;{n;4{@Kvf0Vg{*+X9=lTmB2V@Q(EW diff --git a/files/actions/sea_swamp.xml b/files/actions/sea_swamp.xml deleted file mode 100644 index 86911cb..0000000 --- a/files/actions/sea_swamp.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/files/capture.lua b/files/capture.lua new file mode 100644 index 0000000..6dafb4e --- /dev/null +++ b/files/capture.lua @@ -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 +) diff --git a/files/magic_numbers.xml b/files/magic_numbers.xml index 0f3f779..953226f 100644 --- a/files/magic_numbers.xml +++ b/files/magic_numbers.xml @@ -1,5 +1,7 @@ - + diff --git a/init.lua b/init.lua index 3a36ed4..aa0478c 100644 --- a/init.lua +++ b/init.lua @@ -1,21 +1,18 @@ function OnModPreInit() - print("Mod - OnModPreInit()") -- first this is called for all mods + -- print("Mod - OnModPreInit()") -- first this is called for all mods end 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 function OnModPostInit() - print("Mod - OnModPostInit()") -- then this is called for all mods + -- print("Mod - OnModPostInit()") -- then this is called for all mods end -function OnPlayerSpawned( player_entity ) -- this - GamePrint( "Mods says: Player entity id: " .. tostring(player_entity) ) +function OnPlayerSpawned(player_entity) end - -- 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 -ModMagicNumbersFileAdd( "mods/example/files/magic_numbers.xml" ) -- will override some magic numbers using the specified file -print("Example mod init done") +ModLuaFileAppend("data/scripts/director_init.lua", "mods/capture-all/files/capture.lua") +ModMagicNumbersFileAdd("mods/capture-all/files/magic_numbers.xml") -- override some game constants diff --git a/mod.xml b/mod.xml index 92b6dc5..9d18e58 100644 --- a/mod.xml +++ b/mod.xml @@ -1,5 +1,3 @@ - + \ No newline at end of file