Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 36 additions & 28 deletions Artifacts/gathering.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- hi its azuline again
-- this is my fav artifact from ss1 btw :3 anyways this one is pretty simple i wont be explaining much
-- btw this should prolly be redone a bit to account for nucleus gems when that gets added
-- also also also thanks to onyx (0n_x) for optimizing this mess of an artifact! ! ! ! should be way less laggier now

local loadout = Resources.sprite_load(NAMESPACE, "ArtifactOfGatheringLoadout", path.combine(PATH, "Sprites/Artifacts/Gathering/loadout.png"), 3, 19, 19)
local pickup = Resources.sprite_load(NAMESPACE, "ArtifactOfGatheringPickup", path.combine(PATH, "Sprites/Artifacts/Gathering/pickup.png"), 1, 20, 20)
Expand All @@ -12,34 +13,41 @@ gathering:set_sprites(loadout, pickup)
-- wrapping "self" will also cause a lot of lag so we will have to use game maker functions instead of rmt methods (self:place_meeting() instead of self:is_colliding() for example)
gm.post_code_execute("gml_Object_oEfGold_Create_0", function(self, other)
if not gathering.active then return end
self.life = 1000
end)

gm.pre_code_execute("gml_Object_oEfGold_Step_2", function(self, other)
if not gathering.active then return end
if not self.gathering then -- for some reason this doesnt work if set in post create code
-- value gets set after creation, so waiting a frame to change it
Alarm.create(function()
self.value = self.value * 2
self.gathering = true
end

if self:alarm_get(1) ~= -1 then -- alarm 1 controls whether the gold is homing in on the player or not
self:alarm_set(1, -1) -- setting it to -1 if it isnt already -1 makes it not home in
end

-- alarm 2 controls whether the gold is being picked up
-- whether this alarm is active or not is based on alarm 1, and since we stopped alarm 1 this wont work on its own
if self:alarm_get(2) == -1 and self:place_meeting(self.x, self.y, gm.constants.oP) == 1.0 then -- solution? activate the alarm manually when a coin is colliding with a player object
self:alarm_set(2, 3)
end

if (self.life or 0) > 0 then
self.life = self.life - 1
if self.life < 100 and self.life % 10 < 2 then -- make it blink when about to disappear!!
self.visible = false
else
self.visible = true
end, 1)

-- im unsure if this is faster than finding all instances in a step callback, but both avoid using the gold_onstep, so it shouldnt cause lag while inactive?
Alarm.create(function()
local set_visible -- needs to be done, because otherwise set_visible would be out of scope in set_invisible
local function set_invisible()
if gm.instance_exists(self) then
self.visible = false
Alarm.create(set_visible, 3)
end
end
else
gm.instance_destroy(self)
end
set_visible = function()
if gm.instance_exists(self) then
self.visible = true
Alarm.create(set_invisible, 7)
end
end
Alarm.create(set_invisible, 1)
-- destroy
Alarm.create(function()
if gm.instance_exists(self) then
gm.instance_destroy(self)
end
end, 100)
end, 900)
end)

-- It's preferred to always let basegame functions run, this mostly just undoes what alarm[1] is doing
-- also doesn't need the worksaround with alarm[2]
gm.post_code_execute("gml_Object_oEfGold_Alarm_1", function(self, other)
if not gathering.active then return end
self.hspeed = 0
self.vspeed = 0
self.speed = 1 -- the pickup radius is loosely related to speed, if speed is 0 then you wouldnt be able to pick up the coin
end)
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# SSR Changelog *spoilers below!!*
## 0.1.4
- Optimized Artifact of Gathering to no longer tank performance as much. Which it did even while disabled. Huge thanks to Onyx (0n_x) for this one!

## 0.1.3
- Added 3-4 skins to every survivor except Technician (cuz he had them already)
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "StarstormReturns",
"version_number": "0.1.3",
"version_number": "0.1.4",
"website_url": "https://discord.gg/fGShMVEayr",
"description": "A remaster of Starstorm 1, adding new survivors, items, artifacts, stages, enemies and much more to Risk of Rain Returns.",
"dependencies": [
Expand Down
Loading