Jump to content

Recommended Posts

I'm working on a character for myself in Together- and I've just about finished. Only problem is...

She dies in light. This part is intentional. But one thing that's a problem: The light that appears at your feet when you log into the server during dusk/night. I've looked around and said light doesn't seem to have a prefab. And it mayhaps be due to my being exhausted, but I just can't find the dang thing! Anyone got any lil' fingers to point the way?

I'm not asking for a big finger.

Just a lil' finger.

@Mr. Tiddles the prefab you're looking for is called spawnlight_multiplayer.lua


Edit: This specifically happens in the playerspawner component.

function self:SpawnAtLocation(inst, player, x, y, z, isloading)
    -- if migrating, resolve map location
    if player.migration ~= nil then
        -- make sure we're not just back in our
        -- origin world from a failed migration
        if player.migration.worldid ~= TheShard:GetShardId() then
            x, y, z = GetDestinationPortalLocation(player)
            for i, v in ipairs(player.migrationpets) do
                if v:IsValid() then
                    if v.Physics ~= nil then
                        v.Physics:Teleport(x, y, z)
                    elseif v.Transform ~= nil then
                        v.Transform:SetPosition(x, y, z)
                    end
                end
            end
        end
        player.migration = nil
        player.migrationpets = nil
    end

    print(string.format("Spawning player at: [%s] (%2.2f, %2.2f, %2.2f)", isloading and "Load" or MODES[_mode], x, y, z))
    player.Physics:Teleport(x, y, z)

    -- Spawn a light if it's dark
    if not inst.state.isday and #TheSim:FindEntities(x, y, z, 4, { "spawnlight" }) <= 0 then
        SpawnPrefab("spawnlight_multiplayer").Transform:SetPosition(x, y, z)
    end

    -- Portal FX, disable/give control to player if they're loading in
    if isloading or _mode ~= "fixed" then
        player.AnimState:SetMultColour(0,0,0,1)
        player:Hide()
        player.components.playercontroller:Enable(false)
        local fx = SpawnPrefab("spawn_fx_medium")
        if fx ~= nil then
            fx.entity:SetParent(player.entity)
        end
        player:DoTaskInTime(6*FRAMES, function(inst)
            player:Show()
            player.components.colourtweener:StartTween({1,1,1,1}, 19*FRAMES, function(player)
                player.components.playercontroller:Enable(true)
            end)
        end)
    else
        TheWorld:PushEvent("ms_newplayercharacterspawned", { player = player, mode = isloading and "Load" or MODES[_mode] })
    end
end

 

Edited by Kzisor

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...