Let mod add geo even if map has none!

Let mod add geo even if map has none!

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Let mod add geo even if map has none!

Post by zwzsg »

Some maps do not have geovents.

I have a gadget that lays geovents on the metal spots of such map.

This gadget only work when the feature "geovent" is actually defined.

Old mapconv used to declare geovent and many kind of trees whenever compiling a map, even if no feature of this type was actually placed.

Some newest map compiler do not add the geovent feature def in the map when there isn't any geovent placed on the map.

On those maps, Kernel Panic gadget Lua fails.

I want to fix that Kernel Panic gadget.

I am trying to add a geovent feature (or a "datavent" feature with geoThermal=true) into the pregame FeatureDefs_post.

It appears to be impossible because FeatureHandler.cpp doesn't read any geoThermal tag or similar. So only the engine can make a geovent feature, and if it decide to not, I'm screwed. Mods cannot have their own geo!

An additional issue is that the engine add (or not) the geovent feature *after* the pregame featuredefs_post.lua, so inside the FeatureDefs_post I can't even know if the engine will decide to add a geovent feature def or not.

I request geovent feature def to be always added by engine.

Baring that I request letting mods add their own geothermal vents.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Let mod add geo even if map has none!

Post by FLOZi »

I request both! :-)
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Let mod add geo even if map has none!

Post by zwzsg »

My /gamedata/featuredefs_post.lua (or, to tell the truth, in KP I use a /gamedata/anydefs_post.lua) had:

Code: Select all

FeatureDefs["datavent"]={
    description="Data Vent",
    geoThermal=1,
    footprintx=0,
    footprintz=0,
    height=0,
    blocking=0,
    reclaimable=0,
    drawType=-1,
}
Spring.Echo("========================================")
for n,fd in pairs(FeatureDefs) do
    Spring.Echo("========================================")
    Spring.Echo("FeatureDefs["..n.."]")
    for key,value in pairs(fd) do
        Spring.Echo(key,value)
    end
end
Spring.Echo("========================================")
I also have a widget that goes:

Code: Select all

function widget:GetInfo()
    return {
        name      = "Echo FeatureDefs",
        desc      = "Dump in infolog the content of FeatureDefs",
        author    = "zwzsg",
        date      = "The Ninth of April Two Thousand and Eleven",
        license   = "Free",
        layer     = 0,
        enabled   = true
    }
end

function widget:Initialize()
    for id,featureDef in pairs(FeatureDefs) do
        Spring.Echo("----------------------------------------")
        for name,param in featureDef:pairs() do
            Spring.Echo(name,param)
        end
        Spring.Echo("----------------------------------------")
    end
end
The relevant C++ source file is /rts/Sim/Features/FeatureHandler.cpp
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Let mod add geo even if map has none!

Post by Forboding Angel »

FLOZi wrote:I request both! :-)
This.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Let mod add geo even if map has none!

Post by FLOZi »

I'd even suggest that it might be sensible in the long run for springcontent.sdz to hold these feature defs and not the engine code itself.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Let mod add geo even if map has none!

Post by Forboding Angel »

Couldn't we just make a gadget that removes all geovents from maps and lets us place our own (Tie it to a feature maybe?)

And yeah, +1 with flozi
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Let mod add geo even if map has none!

Post by SirMaverick »

When checking for geoThermal tag, it's possible to create geovents on your own.

Create the feature definition and place them on the map with CreateFeature.
Attachments
geovent on Dark Side Remake
geovent on Dark Side Remake
geovent.jpg (23.89 KiB) Viewed 2643 times
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Let mod add geo even if map has none!

Post by zwzsg »

Commits
sirmaverick (author)
about 1 hour ago
Thanksalot, SirMaverick!
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Let mod add geo even if map has none!

Post by Forboding Angel »

SirMaverick wrote:When checking for geoThermal tag, it's possible to create geovents on your own.

Create the feature definition and place them on the map with CreateFeature.
Image

Thanks mav!
Post Reply

Return to “Feature Requests”