Frozen Ford V2

Frozen Ford V2

All map release threads should be posted here

Moderator: Moderators

Post Reply
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Frozen Ford V2

Post by Beherith »

A new map, this time, with the guest appearance of skyreflectmodtex. The normals rotation for skyreflectmodtex (along with the skycube reflecttex rendering) was fixed in the engine, so for best results, play this map on the BAR version for now, until ivand's improvements propagate upstream.

Once again, pure world machine + springboard, sources included!

Oh its a 12x12 1v1 map btw.

Image

Image

https://springfiles.springrts.com/?type ... 5eeb2b58a0
Attachments
screen01127.jpg
screen01126.jpg
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Frozen Ford V2

Post by PicassoCT »

This needs a river freezing over, shattering under artillery. This needs weeping pathing engine devs in the corner..

Code: Select all

function gadget:GetInfo()
    return {
        name = "River Freeze and break",
        desc = " freezes all water (teraforms it up) and breaks it on bullet impact",
        author = "Picasso",
        date = "3rd of May 2010",
        license = "GPL3",
        layer = 3,
        version = 1,
        enabled = true
    }
end

if (gadgetHandler:IsSyncedCode()) then
    local resolutionStep= 10
    local iceCrackTresholdDamage = 999 
    local terrainDamageMap = makeTable(0, Game.mapSizeX/resolutionStep, Game.mapSizeZ/resolutionStep)
    local spGetUnitPosition = Spring.GetUnitPosition

    -- > Creates a Table and initializes it with default value
    function makeTable(default, xDimension, yDimension, zDimension,
                       boolNegativeMirror)
        boolNegativeMirror = boolNegativeMirror or false

        xStartIndex = 1
        yStartIndex = 1
        zStartIndex = 1

        if boolNegativeMirror == true then
            xStartIndex = -xDimension
            yStartIndex = -yDimension
            zStartIndex = -zDimension
        end

        local RetTable = {}
        if not xDimension then return default end

        for x = xStartIndex, xDimension, 1 do
            if yDimension then
                RetTable[x] = {}
            elseif xDimension then
                RetTable[x] = default
            else
                return default
            end

            if yDimension then
                for y = yStartIndex, yDimension, 1 do
                    if zDimension then
                        RetTable[x][y] = {}
                    else
                        RetTable[x][y] = default
                    end

                    if zDimension then
                        for z = zStartIndex, zDimension, 1 do
                            RetTable[x][y][z] = default
                        end
                    end
                end
            end
        end
        return RetTable
    end

    function transformToMapCoord(x,z)
        return math.ceil(x/resolutionStep), math.ceil(z/resolutionStep)
    end

    function gadget:GameFrame(frame)
        callDistributedTerraformer(frame)
    end

    function callDistributedTerraformer(frame)
        x = (frame % #terrainDamageMap) + 1
        for i=1, #terrainDamageMap[frame] do
            --we only care about water
            if  Spring.GetGroundOrigHeight (  x*resolutionStep,  z* resolutionStep ) < 0 then
                if terrainDamageMap[x][z] > 0 and terrainDamageMap[x] >  iceCrackTresholdDamage + math.random(50, 500) and then
                    --Terraformcode down - the water kills the unit
                    terrainDamageMap[x][z] = 0
                else
                    --terraform slowly up (freeze) 
                end
            end
        end
    end

    function gadget:Explosion(weaponDefID, x, y, z, AttackerID)
         mx,mz = transformToMapCoord(x,z)
         terrainDamageMap[mx][mz] =terrainDamageMap[mx][mz] + WeaponDefs[weaponDefID].damage
    end

    function gadget:UnitDestroyed(unitID, unitDefID, teamID, attackerID)
        x,y,z= spGetUnitPosition(unitID)
        mx,mz = transformToMapCoord(x,z)
        _,maxHp = Spring.GetUnitHealth(unitID)
        terrainDamageMap[mx][mz] =terrainDamageMap[mx][mz] + maxHp
    end

    function gadget:Initialize()  
        terrainDamageMap = makeTable(0, Game.mapSizeX/resolutionStep, Game.mapSizeZ/resolutionStep)   
    end

end
Post Reply

Return to “Map Releases”