From 66d832843a6ae0af89be065762c4e1c64cdf82fc Mon Sep 17 00:00:00 2001 From: Azuline Date: Thu, 23 Oct 2025 16:43:24 +0700 Subject: [PATCH 1/2] gathering cryptocurrency while you are playing the game --- Artifacts/gathering.lua | 64 +++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/Artifacts/gathering.lua b/Artifacts/gathering.lua index ccdda8a1..7cc4a527 100644 --- a/Artifacts/gathering.lua +++ b/Artifacts/gathering.lua @@ -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) @@ -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) \ No newline at end of file From 9164532be7956692998b0c5655c0ffb41fed4b03 Mon Sep 17 00:00:00 2001 From: Azuline Date: Thu, 23 Oct 2025 17:37:06 +0700 Subject: [PATCH 2/2] update incomin --- CHANGELOG.md | 2 ++ manifest.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e778875..47ddddc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/manifest.json b/manifest.json index 7d39e6a9..bd604297 100644 --- a/manifest.json +++ b/manifest.json @@ -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": [