From c0fb8a9c6fc20e1fef86be95bc3f60c67b51f22e Mon Sep 17 00:00:00 2001 From: ChoGGi Date: Mon, 14 Oct 2024 16:24:40 -0600 Subject: [PATCH] Mods: Defence Towers Attack Dust Devils 0.8: Mod option to ignore meteors. Roaming Animals 0.3: Added all animals (all enabled by default). Animals get a random human name. Spire Buildings Anywhere 0.3: Fixed temples not having a roof. github@choggi.org --- .../Code/Script.lua | 57 +++++++++++-------- .../changes.txt | 3 + .../items.lua | 6 ++ .../metadata.lua | 10 +++- Mods ChoGGi/Fix Bugs/Code/Script.lua | 6 -- Mods ChoGGi/Fix Bugs/MoreInfo.md | 1 - Mods ChoGGi/Fix Bugs/changes.txt | 4 +- .../Remove Landscaping Limit/metadata.lua | 6 ++ Mods ChoGGi/Roaming Animals/Code/Script.lua | 38 ++++++++++++- Mods ChoGGi/Roaming Animals/changes.txt | 4 ++ Mods ChoGGi/Roaming Animals/items.lua | 5 ++ Mods ChoGGi/Roaming Animals/metadata.lua | 17 +----- Mods ChoGGi/Roaming Animals/todo.txt | 2 - .../Spire Buildings Anywhere/Code/Script.lua | 22 ++++++- .../Spire Buildings Anywhere/changes.txt | 3 + .../Spire Buildings Anywhere/items.lua | 7 +++ .../Spire Buildings Anywhere/metadata.lua | 4 +- 17 files changed, 137 insertions(+), 58 deletions(-) delete mode 100644 Mods ChoGGi/Roaming Animals/todo.txt diff --git a/Mods ChoGGi/Defence Towers Attack Dust Devils/Code/Script.lua b/Mods ChoGGi/Defence Towers Attack Dust Devils/Code/Script.lua index 28f1c1d29..13b04ba97 100644 --- a/Mods ChoGGi/Defence Towers Attack Dust Devils/Code/Script.lua +++ b/Mods ChoGGi/Defence Towers Attack Dust Devils/Code/Script.lua @@ -3,11 +3,13 @@ local pairs = pairs local Sleep = Sleep local IsValidThread = IsValidThread +local IsValid = IsValid local mod_EnableMod local mod_UnlockDefenseTowers +local mod_IgnoreMeteors --- unlock the tech at start +-- Unlock the tech at start local function UnlockTowers() if mod_EnableMod and mod_UnlockDefenseTowers then UnlockBuilding("DefenceTower") @@ -24,6 +26,7 @@ local function ModOptions(id) mod_EnableMod = CurrentModOptions:GetProperty("EnableMod") mod_UnlockDefenseTowers = CurrentModOptions:GetProperty("UnlockDefenseTowers") + mod_IgnoreMeteors = CurrentModOptions:GetProperty("IgnoreMeteors") -- make sure we're in-game if not UIColony then @@ -37,76 +40,80 @@ OnMsg.ModsReloaded = ModOptions -- Fired when Mod Options>Apply button is clicked OnMsg.ApplyModOptions = ModOptions --- list of devil handles we're attacking -local devils = {} +-- List of devil handles we're attacking +local attacked_devils = {} --- replace orig func with mine +-- Replace orig func with mine local ChoOrig_DefenceTower_DefenceTick = DefenceTower.DefenceTick function DefenceTower:DefenceTick(...) - -- place at end of function to have it protect dustdevils before meteors - ChoOrig_DefenceTower_DefenceTick(self, ...) + -- Place at end of function to have it protect dustdevils before meteors + if not mod_IgnoreMeteors then + ChoOrig_DefenceTower_DefenceTick(self, ...) + end if not mod_EnableMod then return end - -- copied from orig func + -- If a track thread is running wait for it to finish (copied from orig func) if IsValidThread(self.track_thread) then return end - -- list of dustdevils on map + -- List of dustdevils on map local dustdevils = g_DustDevils or "" for i = 1, #dustdevils do local devil = dustdevils[i] - -- get dist (added * 10 as tower didn't see to target at the range of its hex grid) + -- Get dist (added * 10 as tower didn't see to target at the range of its hex grid) -- It could be from me increasing protection radius, or just how it targets meteors if IsValid(devil) and self:GetVisualDist(devil) <= self.shoot_range * 10 then - -- make sure tower is working + -- Make sure tower is working if not IsValid(self) or not self.working or self.destroyed then return end - -- .follow = small ones attached to majors (they go away if major is gone) - if not devil.follow and not devils[devil.handle] then - -- aim the tower at the dustdevil + -- .follow = small ones attached to major ones (they go away if major is gone) + if not devil.follow and not attacked_devils[devil.handle] then + -- Aim the tower at the dustdevil + -- 7200 = 120*60 self:OrientPlatform(devil:GetVisualPos(), 7200) - -- fire in the hole + -- Fire in the hole local rocket = self:FireRocket(nil, devil) - -- store handle so we only launch one per devil - devils[devil.handle] = devil - -- seems like safe bets to set + -- Store handle so we only launch one per devil + attacked_devils[devil.handle] = devil + -- Seems like safe bets to set self.meteor = devil self.is_firing = true - -- sleep till rocket explodes + -- Sleep till rocket explodes CreateRealTimeThread(function() while rocket.move_thread do - Sleep(500) + Sleep(250) end - -- make it pretty + -- Make it pretty if IsValid(devil) then local snd = PlaySound("Mystery Bombardment ExplodeAir", "ObjectOneshot", nil, 0, false, devil) PlayFX("AirExplosion", "start", devil, devil:GetAttaches()[1], devil:GetPos()) Sleep(GetSoundDuration(snd)) - -- kill the devil object + -- Kill the devil object devil:delete() end self.meteor = false self.is_firing = false end) - -- back to the usual stuff + -- Back to the usual stuff Sleep(self.reload_time) + -- DefenceTick needs it for defence_thread return true end end end - -- only remove devil handles if they're actually gone - for handle, devil in pairs(devils) do + -- Only remove devil handles if they're actually gone + for handle, devil in pairs(attacked_devils) do if not IsValid(devil) then - devils[handle] = nil + attacked_devils[handle] = nil end end diff --git a/Mods ChoGGi/Defence Towers Attack Dust Devils/changes.txt b/Mods ChoGGi/Defence Towers Attack Dust Devils/changes.txt index 63174908f..f14a34d21 100644 --- a/Mods ChoGGi/Defence Towers Attack Dust Devils/changes.txt +++ b/Mods ChoGGi/Defence Towers Attack Dust Devils/changes.txt @@ -1,3 +1,6 @@ +v0.8 +Mod option to ignore meteors. + v0.7 Added mod options to disable mod/unlock turrets. diff --git a/Mods ChoGGi/Defence Towers Attack Dust Devils/items.lua b/Mods ChoGGi/Defence Towers Attack Dust Devils/items.lua index f8e872ef6..1223a6e9b 100644 --- a/Mods ChoGGi/Defence Towers Attack Dust Devils/items.lua +++ b/Mods ChoGGi/Defence Towers Attack Dust Devils/items.lua @@ -13,4 +13,10 @@ return { "Help", T(302535920011994, "Start with towers unlocked (needed unless playing mystery that unlocks them)."), "DefaultValue", true, }), + PlaceObj("ModItemOptionToggle", { + "name", "IgnoreMeteors", + "DisplayName", T(0000, "Ignore Meteors"), + "Help", T(0000, "Turn on to have towers ignore meteors."), + "DefaultValue", false, + }), } diff --git a/Mods ChoGGi/Defence Towers Attack Dust Devils/metadata.lua b/Mods ChoGGi/Defence Towers Attack Dust Devils/metadata.lua index 1c0cfbbd6..502968b8d 100644 --- a/Mods ChoGGi/Defence Towers Attack Dust Devils/metadata.lua +++ b/Mods ChoGGi/Defence Towers Attack Dust Devils/metadata.lua @@ -12,9 +12,9 @@ return PlaceObj("ModDef", { "steam_id", "1504597628", "pops_any_uuid", "957bd9ec-fb96-4c00-9065-984aae313e1f", "lua_revision", 1007000, -- Picard - "version", 7, + "version", 8, "version_major", 0, - "version_minor", 7, + "version_minor", 8, "author", "ChoGGi", "code", { "Code/Script.lua", @@ -25,6 +25,12 @@ return PlaceObj("ModDef", { "description", [[ Defence Turrets will attack Dust Devils. + +Mod Options: +Unlock Tech Defence Turret: Start with towers unlocked (needed unless playing mystery that unlocks them). +Ignore Meteors: Turn on to have towers ignore meteors. + + Requested by: rdr99 and Emmote https://steamcommunity.com/app/464920/discussions/0/2828702373008348129/ ]], diff --git a/Mods ChoGGi/Fix Bugs/Code/Script.lua b/Mods ChoGGi/Fix Bugs/Code/Script.lua index 686059666..bfb7659d8 100644 --- a/Mods ChoGGi/Fix Bugs/Code/Script.lua +++ b/Mods ChoGGi/Fix Bugs/Code/Script.lua @@ -238,12 +238,6 @@ do end end - -- - -- I'm going out on a limb and saying tourist gurus are a bug. - -- Odd that GuruTraitBlacklist.Tourist doesn't seem to work... - TraitPresets.Guru.incompatible.Tourist = true - TraitPresets.Tourist.incompatible.Guru = true - -- -- Cargo presets are missing images for some buildings/all resources local articles = Presets.EncyclopediaArticle.Resources diff --git a/Mods ChoGGi/Fix Bugs/MoreInfo.md b/Mods ChoGGi/Fix Bugs/MoreInfo.md index 0a34f9bca..5a1c22ab8 100644 --- a/Mods ChoGGi/Fix Bugs/MoreInfo.md +++ b/Mods ChoGGi/Fix Bugs/MoreInfo.md @@ -17,7 +17,6 @@ Problem updating supply grid. Colonists on an expedition now show proper status when selected from command centre (instead of just unknown). Added missing images for certain Cargo listings. Gale crater name doesn't show up for 4S138E, 5S138E. -Stopped Tourist Gurus from happening. Storybits: Gene Forging storybit tech doesn't increase rare traits chance. diff --git a/Mods ChoGGi/Fix Bugs/changes.txt b/Mods ChoGGi/Fix Bugs/changes.txt index cbc12e253..7b080c023 100644 --- a/Mods ChoGGi/Fix Bugs/changes.txt +++ b/Mods ChoGGi/Fix Bugs/changes.txt @@ -1,3 +1,6 @@ +v6.9X +Removed uneeded Guru Tourist fix. + v6.8 Fixed Rivals Trade Minerals mod hiding Exotic Minerals from lander UI (thanks DouViction). @@ -15,7 +18,6 @@ Removes stuck cursor buildings (reddish coloured). v6.3 Elevator func not checking for invalid resources (seen an error in an unrelated log file). -Stopped Tourist Gurus from happening (https://www.reddit.com/r/SurvivingMars/comments/1f178q0/how/) v6.2 Added my Pins Missing Some Status Icons mod. diff --git a/Mods ChoGGi/Remove Landscaping Limit/metadata.lua b/Mods ChoGGi/Remove Landscaping Limit/metadata.lua index 22344b95a..4eded913c 100644 --- a/Mods ChoGGi/Remove Landscaping Limit/metadata.lua +++ b/Mods ChoGGi/Remove Landscaping Limit/metadata.lua @@ -31,6 +31,12 @@ This will allow you to build regular buildings on top of others, turn off the bl This overrides max and min sizes. + +Known Issues: +This sets the max tool size to a large number, there's no way for a disabled mod to do cleanup (and you're not supposed to remove mods mid-game). +If you don't like seeing a large number when doing landscaping then don't install the mod. + + Mod Options: Step Size: How much to adjust the size of the landscaping area by. Skip Blocking Objects: Turn on to be able to paint terrain near buildings. This will also allow you to place buildings in odd places. diff --git a/Mods ChoGGi/Roaming Animals/Code/Script.lua b/Mods ChoGGi/Roaming Animals/Code/Script.lua index a36116139..91c26579b 100644 --- a/Mods ChoGGi/Roaming Animals/Code/Script.lua +++ b/Mods ChoGGi/Roaming Animals/Code/Script.lua @@ -9,34 +9,55 @@ if not g_AvailableDlc.shepard then return end --- Almost a complete copy pasta of my RoamingAnimal Visitors mod... +-- Almost a complete copy pasta of my Alien Visitors mod... -- The roaming part at least, this adds the other models/limits to when to spawn local animals = { {"Chicken", T(299174615385--[[Chicken]])}, Chicken = {"Chicken", T(299174615385--[[Chicken]])}, + -- {"Deer", T(409677371105--[[Deer]])}, Deer = {"Deer", T(409677371105--[[Deer]])}, + -- {"Goose", T(319767019420--[[Goose]])}, Goose = {"Goose", T(319767019420--[[Goose]])}, + -- {"Lama_Ambient", T(808881013020--[[Llama]])}, Lama_Ambient = {"Lama_Ambient", T(808881013020--[[Llama]])}, + -- {"Ostrich", T(929526939780--[[Ostrich]])}, Ostrich = {"Ostrich", T(929526939780--[[Ostrich]])}, + -- {"Pig", T(221418710774--[[Pig]])}, Pig = {"Pig", T(221418710774--[[Pig]])}, + -- {"Pony_01", T(176071455701--[[Pony]])}, Pony_01 = {"Pony_01", T(176071455701--[[Pony]])}, {"Pony_02", T(176071455701--[[Pony]])}, Pony_02 = {"Pony_02", T(176071455701--[[Pony]])}, {"Pony_03", T(176071455701--[[Pony]])}, Pony_03 = {"Pony_03", T(176071455701--[[Pony]])}, + -- {"Rabbit_01", T(520473377733--[[Rabbit]])}, Rabbit_01 = {"Rabbit_01", T(520473377733--[[Rabbit]])}, {"Rabbit_02", T(520473377733--[[Rabbit]])}, Rabbit_02 = {"Rabbit_02", T(520473377733--[[Rabbit]])}, + -- {"Turkey", T(977344055059--[[Turkey]])}, Turkey = {"Turkey", T(977344055059--[[Turkey]])}, + -- + {"Tortoise", T(768070368933--[[Tortoise]])}, + Tortoise = {"Tortoise", T(768070368933--[[Tortoise]])}, + -- + {"Platypus", T(210528297343--[[Platypus]])}, + Platypus = {"Platypus", T(210528297343--[[Platypus]])}, + -- + {"Penguin_01", T(397432391921--[[Penguin]])}, + Penguin_01 = {"Penguin_01", T(397432391921--[[Penguin]])}, + {"Penguin_02", T(397432391921--[[Penguin]])}, + Penguin_02 = {"Penguin_02", T(397432391921--[[Penguin]])}, + {"Penguin_03", T(397432391921--[[Penguin]])}, + Penguin_03 = {"Penguin_03", T(397432391921--[[Penguin]])}, } local temp_animals = {} @@ -139,6 +160,16 @@ local function IsPlayablePoint(pt) return pt:InBox2D(MainCity.MapArea) and GetBuildableZ(WorldToHex(pt:xy())) ~= UnbuildableZ and terrain:IsPassable(pt) end +-- Build list of all names in HumanNames +local names = {} +local iappend = table.iappend +local HumanNames = HumanNames +for _, nation in pairs(HumanNames) do + for _, name_list in pairs(nation) do + iappend(names, name_list) + end +end + function ChoGGi_RoamingAnimal:Init() local city = self.city or MainCity self.city = city @@ -147,7 +178,10 @@ function ChoGGi_RoamingAnimal:Init() local animal = table.rand(temp_animals) self:ChangeEntity(animal[1]) - self.display_name = animal[2] + + -- Pick a name for animal +--~ self.display_name = animal[2] + self.display_name = table.rand(names) self:Spawn() self:SetPos(self.spawn_pos) diff --git a/Mods ChoGGi/Roaming Animals/changes.txt b/Mods ChoGGi/Roaming Animals/changes.txt index 3e826384e..0fcbe8bcd 100644 --- a/Mods ChoGGi/Roaming Animals/changes.txt +++ b/Mods ChoGGi/Roaming Animals/changes.txt @@ -1,3 +1,7 @@ +v0.3 +Added all animals (all enabled by default). +Animals get a random human name. + v0.2 Added mod options to pick animals. Made sure it can't go over the max amount. diff --git a/Mods ChoGGi/Roaming Animals/items.lua b/Mods ChoGGi/Roaming Animals/items.lua index 70d1e61ed..654788280 100644 --- a/Mods ChoGGi/Roaming Animals/items.lua +++ b/Mods ChoGGi/Roaming Animals/items.lua @@ -47,6 +47,11 @@ local animals = { {"Rabbit_01", T(520473377733--[[Rabbit]])}, {"Rabbit_02", T(520473377733--[[Rabbit]])}, {"Turkey", T(977344055059--[[Turkey]])}, + {"Tortoise", T(768070368933--[[Tortoise]])}, + {"Platypus", T(210528297343--[[Platypus]])}, + {"Penguin_01", T(397432391921--[[Penguin]])}, + {"Penguin_02", T(397432391921--[[Penguin]])}, + {"Penguin_03", T(397432391921--[[Penguin]])}, } for i = 1, #animals do diff --git a/Mods ChoGGi/Roaming Animals/metadata.lua b/Mods ChoGGi/Roaming Animals/metadata.lua index 8944e9ae0..d048cd088 100644 --- a/Mods ChoGGi/Roaming Animals/metadata.lua +++ b/Mods ChoGGi/Roaming Animals/metadata.lua @@ -12,9 +12,9 @@ return PlaceObj("ModDef", { "steam_id", "3325314585", "pops_any_uuid", "1aacc028-422d-46bc-a01f-9f54abcfa498", "lua_revision", 1007000, -- Picard - "version", 2, + "version", 3, "version_major", 0, - "version_minor", 2, + "version_minor", 3, "image", "Preview.jpg", "author", "ChoGGi", "code", { @@ -25,18 +25,7 @@ return PlaceObj("ModDef", { "TagVegetation", true, "description", [[ Spawns animals after 100 "promoted" trees (fully grown trees). - -Only spawns animals that kinda fit in a forest setting. -Chicken -Deer -Goose -Llama -Ostrich -Pig -Pony -Rabbit -Turkey -See mod options to select animals. +By default spawns all animals, see mod options to pick which to spawn. Mod Options: diff --git a/Mods ChoGGi/Roaming Animals/todo.txt b/Mods ChoGGi/Roaming Animals/todo.txt deleted file mode 100644 index d187bde98..000000000 --- a/Mods ChoGGi/Roaming Animals/todo.txt +++ /dev/null @@ -1,2 +0,0 @@ -give them names -add rest of animals diff --git a/Mods ChoGGi/Spire Buildings Anywhere/Code/Script.lua b/Mods ChoGGi/Spire Buildings Anywhere/Code/Script.lua index 87d0d6f74..0a6b1acff 100644 --- a/Mods ChoGGi/Spire Buildings Anywhere/Code/Script.lua +++ b/Mods ChoGGi/Spire Buildings Anywhere/Code/Script.lua @@ -1,6 +1,7 @@ -- See LICENSE for terms local mod_EnableMod +--~ local mod_CleanLeftovers local function ModOptions(id) -- id is from ApplyModOptions @@ -9,6 +10,11 @@ local function ModOptions(id) end mod_EnableMod = CurrentModOptions:GetProperty("EnableMod") +--~ mod_CleanLeftovers = CurrentModOptions:GetProperty("CleanLeftovers") + +--~ -- Remove leftovers +--~ if UIColony and mod_CleanLeftovers then +--~ end end -- Load default/saved settings OnMsg.ModsReloaded = ModOptions @@ -22,7 +28,11 @@ local UnbuildableZ = buildUnbuildableZ() -- last checked 1010999 local ChoOrig_ConstructionController_UpdateCursor = ConstructionController.UpdateCursor function ConstructionController:UpdateCursor(pos, force, ...) - if not mod_EnableMod then + if not mod_EnableMod or not self.is_template then + return ChoOrig_ConstructionController_UpdateCursor(self, pos, force, ...) + end + + if self.template_obj.dome_spot ~= "Spire" then return ChoOrig_ConstructionController_UpdateCursor(self, pos, force, ...) end @@ -96,9 +106,15 @@ function SpireBase:UpdateFrame(...) return end - -- Remove x/y offset, but keep height local frame = attaches[1] - frame:SetAttachOffset(point(0, 0, frame:GetAttachOffset():z())) + if frame.entity == "TempleSpireFrame" and IsValid(self.parent_dome) then + local dome_height = ObjectHierarchyBBox(self.parent_dome, const.efCollision):size():z() + frame:SetAttachOffset(point(0, 0, dome_height)) + else + -- Remove x/y offset, but keep height + -- Arcology band? + frame:SetAttachOffset(point(0, 0, frame:GetAttachOffset():z())) + end return ret end diff --git a/Mods ChoGGi/Spire Buildings Anywhere/changes.txt b/Mods ChoGGi/Spire Buildings Anywhere/changes.txt index df3c7205a..608b1d3ed 100644 --- a/Mods ChoGGi/Spire Buildings Anywhere/changes.txt +++ b/Mods ChoGGi/Spire Buildings Anywhere/changes.txt @@ -1,2 +1,5 @@ +v0.3 +Fixed temples not having a roof. + v0.2 Moves spire frame to spire instead of whatever dome spire spot is closer. diff --git a/Mods ChoGGi/Spire Buildings Anywhere/items.lua b/Mods ChoGGi/Spire Buildings Anywhere/items.lua index 3d28978ee..b5e6fac56 100644 --- a/Mods ChoGGi/Spire Buildings Anywhere/items.lua +++ b/Mods ChoGGi/Spire Buildings Anywhere/items.lua @@ -7,4 +7,11 @@ return { "Help", T(302535920011793, "Disable mod without having to see missing mod msg."), "DefaultValue", true, }), +--~ PlaceObj("ModItemOptionToggle", { +--~ "name", "CleanLeftovers", +--~ "DisplayName", T(0000, "Clean Leftovers"), +--~ "Help", T(0000, [[If turned on (no point in turning it off): +--~ This cleans out stuff left over when you remove spires; Arcology and Temple leaves stuff.]]), +--~ "DefaultValue", true, +--~ }), } diff --git a/Mods ChoGGi/Spire Buildings Anywhere/metadata.lua b/Mods ChoGGi/Spire Buildings Anywhere/metadata.lua index 1b47d25b0..70376060e 100644 --- a/Mods ChoGGi/Spire Buildings Anywhere/metadata.lua +++ b/Mods ChoGGi/Spire Buildings Anywhere/metadata.lua @@ -4,9 +4,9 @@ return PlaceObj("ModDef", { "steam_id", "2713014161", "pops_any_uuid", "9356afd6-e99d-41f8-a290-222bc74666ad", "lua_revision", 1007000, -- Picard - "version", 2, + "version", 3, "version_major", 0, - "version_minor", 2, + "version_minor", 3, "image", "Preview.jpg", "author", "ChoGGi", "code", {