Carpet

Carpet

2M Downloads

[suggestion] all true player sleeping

Sanluli36li opened this issue · 1 comments

commented

emmmm...
I want everyone to sleep to skip the night, but the fake player stopped us
For this I also wrote a script

__config() -> {'scope' -> 'global', 'stay_loaded' -> true};

global_sleeptick = 0;

__on_tick() ->
(
    if(global_sleeptick == 100,
        day_time(23999);
        run('weather clear');
    );

    for(entity_list('player'),
        // 在主世界 且 没睡觉 且 旁观者模式 且 不是假人 -> 重置睡眠计时
        if(_~'dimension' == 'overworld' && _~'pose' != 'sleeping' && _~'gamemode' != 'spectator' && _~'player_type' != 'fake' , 
            //print(_~'name' + ': ' + _~'dimension' + ' ' + _~'pose' + ' ' + _~'gamemode' + ' ' + _~'player_type');
            global_sleeptick = 0;
            
            return();
        )
    );
    // 睡眠计时器
    global_sleeptick += 1;
    //print(global_sleeptick)
);
commented

I suggest you post it to scarpet repo as the place for useful scripts that other may want to use.

Instead of resetting the time to 23999, i suggest adding to it so that its right before morning, thus not resetting the world timer.