Skip to content

Commit

Permalink
Mods:
Browse files Browse the repository at this point in the history
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.

[email protected]
  • Loading branch information
ChoGGi committed Oct 14, 2024
1 parent f6fbcbf commit c0fb8a9
Show file tree
Hide file tree
Showing 17 changed files with 137 additions and 58 deletions.
57 changes: 32 additions & 25 deletions Mods ChoGGi/Defence Towers Attack Dust Devils/Code/Script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions Mods ChoGGi/Defence Towers Attack Dust Devils/changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v0.8
Mod option to ignore meteors.

v0.7
Added mod options to disable mod/unlock turrets.

Expand Down
6 changes: 6 additions & 0 deletions Mods ChoGGi/Defence Towers Attack Dust Devils/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
}
10 changes: 8 additions & 2 deletions Mods ChoGGi/Defence Towers Attack Dust Devils/metadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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/
]],
Expand Down
6 changes: 0 additions & 6 deletions Mods ChoGGi/Fix Bugs/Code/Script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Mods ChoGGi/Fix Bugs/MoreInfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion Mods ChoGGi/Fix Bugs/changes.txt
Original file line number Diff line number Diff line change
@@ -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).

Expand All @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions Mods ChoGGi/Remove Landscaping Limit/metadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
38 changes: 36 additions & 2 deletions Mods ChoGGi/Roaming Animals/Code/Script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions Mods ChoGGi/Roaming Animals/changes.txt
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions Mods ChoGGi/Roaming Animals/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 3 additions & 14 deletions Mods ChoGGi/Roaming Animals/metadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand All @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions Mods ChoGGi/Roaming Animals/todo.txt

This file was deleted.

Loading

0 comments on commit c0fb8a9

Please sign in to comment.