Skip to content

Commit

Permalink
Mods:
Browse files Browse the repository at this point in the history
Fix Bugs 6.5:
Mispelling meant a couple fixes weren't being applied to underground map (thanks Mikaaar).

Roaming Animals:
Spawns animals after 100 "promoted" trees.

Surface Resource Markers 0.2:
Added exotic minerals and rare metals.

[email protected]
  • Loading branch information
ChoGGi committed Sep 6, 2024
1 parent 8b29006 commit 0f81bbb
Show file tree
Hide file tree
Showing 16 changed files with 700 additions and 207 deletions.
4 changes: 2 additions & 2 deletions ChoGGi's Library/Code/CommonFunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3977,7 +3977,7 @@ do -- AddBlinkyToObj
blinky_obj:SetAttachOffset(point(0, 0, offset))
-- hide blinky after we select something else or timeout, we don't delete since we move it from obj to obj
blinky_thread = CreateRealTimeThread(function()
WaitMsg("SelectedObjChange", timeout or 10000)
WaitMsg("SelectedObjChange", timeout or 5000)
blinky_obj:SetVisible()
end)
end
Expand Down Expand Up @@ -7580,7 +7580,7 @@ function ChoGGi_Funcs.Common.SetAnimState(obj)
if value ~= "idle" then
obj:SetState(value)
MsgPopup(
ChoGGi_Funcs.Common.SettingState(choice.text),
choice.text,
T(302535920000859--[[Anim State]])
)
end
Expand Down
114 changes: 57 additions & 57 deletions Mods ChoGGi/Alien Visitors/Code/Script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ local DomeCollisionCheck = DomeCollisionCheck
local WorldToHex = WorldToHex
local GetBuildableZ = GetBuildableZ
local AsyncRand = AsyncRand
local RotateRadius = RotateRadius

local InvalidPos = ChoGGi.Consts.InvalidPos

Expand All @@ -32,6 +33,7 @@ local image_pin = CurrentModPath .. "UI/Alien_Pin.png"
DefineClass.ChoGGi_Alien = {
--~ __parents = { "Unit", "CityObject", "PinnableObject", "Shapeshifter", "InfopanelObj", "CycleMember" },
__parents = { "Unit", "PinnableObject", "Shapeshifter", "InfopanelObj"},
-- If no entity then it won't walk even with ChangeEntity later on
entity = "GreenMan",
-- slightly slower than colonists (wonder why Child doesn't move slower an Adult)
move_speed = 800,
Expand Down Expand Up @@ -83,12 +85,12 @@ end

local UnbuildableZ = buildUnbuildableZ()
local function IsPlayablePoint(pt)
return pt:InBox2D(UICity.MapArea) and GetBuildableZ(WorldToHex(pt:xy())) ~= UnbuildableZ and ActiveGameMap.terrain:IsPassable(pt)
return pt:InBox2D(MainCity.MapArea) and GetBuildableZ(WorldToHex(pt:xy())) ~= UnbuildableZ and GameMaps[MainMapID].terrain:IsPassable(pt)
end

local names_list = {"Family", "Female", "Male"}
function ChoGGi_Alien:Init()
local city = self.city or UICity
local city = self.city or MainCity
self.city = city

city:AddToLabel("ChoGGi_Alien", self)
Expand All @@ -102,16 +104,13 @@ function ChoGGi_Alien:Init()
end
function ChoGGi_Alien:Done()
self.city:RemoveFromLabel("ChoGGi_Alien", self)
if IsValid(self) then
self:delete()
end
end

function ChoGGi_Alien:Spawn()
-- pick a random buildable spot within the playable area
local city = self.city or UICity
local city = self.city or MainCity
local spawn_pos = self.spawn_pos
local sectors = UICity.MapSectors
local sectors = MainCity.MapSectors

-- pick position
while not spawn_pos do
Expand Down Expand Up @@ -145,7 +144,7 @@ end
local m36060 = 360*60
function ChoGGi_Alien:RoamTick()
-- pick a random playable pos within roam_target_radius, but outside of a dome
local city = self.city or UICity
local city = self.city or MainCity
local pos = self:GetPos()
local roam_target

Expand Down Expand Up @@ -178,58 +177,11 @@ function ChoGGi_Alien:RoamTick()
Sleep(1000 + self:Random(1000))
end

--~ local gofUnderConstruction = const.gofUnderConstruction
--~ function ChoGGi_Alien:GetElecBldNearby(rad) --within charge range
--~ rad = rad or self.electricity_radius

--~ local lst = GetRealm(self):MapGet(self, "hex", rad + 1, "ElectricityConsumer", function(o) return o:GetGameFlags(gofUnderConstruction) == 0 end )
--~ local c = FindNearestObject(lst, self)
--~ return c and HexAxialDistance(c, self) <= rad and c or false
--~ end

--~ function ChoGGi_Alien:PowerNearbyBld()
--~ if not IsValid(self.nearby_building) then
--~ return
--~ end
--~ print("PowerNearbyBld")

--~ local old_grid = self.electricity and self.electricity.grid
--~ local new_grid = self.nearby_building and self.nearby_building.electricity.grid
--~ if old_grid == new_grid then
--~ return
--~ end

--~ if not self.nearby_building and self.nearby_building then
--~ PlayFX("Working", "start", self.panel_obj)
--~ elseif self.nearby_building and not self.nearby_building then
--~ PlayFX("Working", "end", self.panel_obj)
--~ end

--~ if old_grid then
--~ old_grid:RemoveElement(self.electricity)
--~ end
--~ if not new_grid then
--~ self.production_lifetime = self.production_lifetime + self.electricity.production_lifetime
--~ self.electricity = false
--~ else
--~ if not self.electricity then
--~ self.electricity = NewSupplyGridProducer(self)
--~ self.electricity:SetProduction(self.electricity_production)
--~ end
--~ new_grid:AddElement(self.electricity)
--~ end
--~ if SelectedObj == self then
--~ ReopenSelectionXInfopanel()
--~ end
--~ ex(self.electricity)
--~ ex(self.nearby_building.electricity)
--~ end

function ChoGGi_Alien:Roam()
while true do
self:RoamTick()
if not self:IsValid() then
self:Done()
DoneObject(self)
break
end
end
Expand Down Expand Up @@ -259,7 +211,6 @@ local function StartupCode()
count = 4
end


for _ = 1, count do
local obj = ChoGGi_Alien:new()
SetPosRandomBuildablePos(obj)
Expand Down Expand Up @@ -313,3 +264,52 @@ function OnMsg.ClassesPostprocess()
}),
})
end

-- add some alien power to grid when nearby

--~ local gofUnderConstruction = const.gofUnderConstruction
--~ function ChoGGi_Alien:GetElecBldNearby(rad) --within charge range
--~ rad = rad or self.electricity_radius

--~ local lst = GetRealm(self):MapGet(self, "hex", rad + 1, "ElectricityConsumer", function(o) return o:GetGameFlags(gofUnderConstruction) == 0 end )
--~ local c = FindNearestObject(lst, self)
--~ return c and HexAxialDistance(c, self) <= rad and c or false
--~ end

--~ function ChoGGi_Alien:PowerNearbyBld()
--~ if not IsValid(self.nearby_building) then
--~ return
--~ end
--~ print("PowerNearbyBld")

--~ local old_grid = self.electricity and self.electricity.grid
--~ local new_grid = self.nearby_building and self.nearby_building.electricity.grid
--~ if old_grid == new_grid then
--~ return
--~ end

--~ if not self.nearby_building and self.nearby_building then
--~ PlayFX("Working", "start", self.panel_obj)
--~ elseif self.nearby_building and not self.nearby_building then
--~ PlayFX("Working", "end", self.panel_obj)
--~ end

--~ if old_grid then
--~ old_grid:RemoveElement(self.electricity)
--~ end
--~ if not new_grid then
--~ self.production_lifetime = self.production_lifetime + self.electricity.production_lifetime
--~ self.electricity = false
--~ else
--~ if not self.electricity then
--~ self.electricity = NewSupplyGridProducer(self)
--~ self.electricity:SetProduction(self.electricity_production)
--~ end
--~ new_grid:AddElement(self.electricity)
--~ end
--~ if SelectedObj == self then
--~ ReopenSelectionXInfopanel()
--~ end
--~ ex(self.electricity)
--~ ex(self.nearby_building.electricity)
--~ end
26 changes: 13 additions & 13 deletions Mods ChoGGi/All Animals As Pets/Code/Script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,42 @@ end

local roaming_pets = {
Tortoise = {
display_name = T(768070368933,"Tortoise"),
display_name = T(768070368933--[[Tortoise]]),
ambient = "Penguin",
entities = {"Tortoise"},
},
Platypus = {
display_name = T(210528297343,"Platypus"),
display_name = T(210528297343--[[Platypus]]),
ambient = "Penguin",
entities = {"Platypus"},
},
Chicken = {
display_name = T(299174615385,"Chicken"),
display_name = T(299174615385--[[Chicken]]),
ambient = "Lama",
entities = {"Chicken"},
},
Turkey = {
display_name = T(977344055059,"Turkey"),
display_name = T(977344055059--[[Turkey]]),
ambient = "Lama",
entities = {"Turkey"},
},
Pig = {
display_name = T(221418710774,"Pig"),
display_name = T(221418710774--[[Pig]]),
ambient = "Lama",
entities = {"Pig"},
},
Ostrich = {
display_name = T(929526939780,"Ostrich"),
display_name = T(929526939780--[[Ostrich]]),
ambient = "Lama",
entities = {"Ostrich"},
},
Goose = {
display_name = T(319767019420,"Goose"),
display_name = T(319767019420--[[Goose]]),
ambient = "Lama",
entities = {"Goose"},
},
GreenMan = {
display_name = T(302535920011640,"GreenMan"),
display_name = T(302535920011640, "GreenMan"),
ambient = "Penguin",
entities = {"GreenMan"},
},
Expand All @@ -70,23 +70,23 @@ local pet_pets = {
Goose = roaming_pets.Goose,
GreenMan = roaming_pets.GreenMan,
Deer = {
display_name = T(409677371105,"Deer"),
display_name = T(409677371105--[[Deer]]),
entities = {"Deer"},
},
Penguin = {
display_name = T(397432391921,"Penguin"),
display_name = T(397432391921--[[Penguin]]),
entities = {"Penguin_01", "Penguin_02", "Penguin_03"},
},
Rabbit = {
display_name = T(520473377733,"Rabbit"),
display_name = T(520473377733--[[Rabbit]]),
entities = {"Rabbit_01", "Rabbit_02"},
},
Pony = {
display_name = T(176071455701,"Pony"),
display_name = T(176071455701--[[Pony]]),
entities = {"Pony_01", "Pony_02", "Pony_03"},
},
Llama = {
display_name = T(808881013020,"Llama"),
display_name = T(808881013020--[[Llama]]),
entities = {"Lama_Ambient"},
},
}
Expand Down
Loading

0 comments on commit 0f81bbb

Please sign in to comment.