Jump to content

DST equivalent of GetWorldPosition()?


Recommended Posts

1 hour ago, YakumoYukari said:

I think this is what you're looking for.


x,y,z = inst.Transform:GetWorldPosition()

 

Thanks!

P.S. Sorry for bugging you more But what would GetClock be in Don't starve together?

Link to comment
Share on other sites

Just now, YakumoYukari said:

I believe there's no GetClock or TheClock things. You have to approach it by problem-specific.
What exactly trying to do?

inst:DoTaskInTime(math.random(), function() 
      --print(inst, "spawn check day")
        if not GetClock():IsDay() then 
            Empty(inst)
        end 
    end)

So something like this, if it isn't day then the function Empty is performed

(For context this is a home for a creature called elder mandrake, it leaves its home during dusk and night but stays in the day)

 

Link to comment
Share on other sites

There're two options.

1. Use WatchWorldState. (Recommended)

 

2. Get law worldstate data.
Seems your case doesn't need to bind to WatchWorldState(). Instead, you can directly get the value of worldstate(isday) by

isday = TheWorld.components.worldstate.data.isday

The code above will detect daytime overworld only(otherwise it's always false). If you need to detect it also in Cave,

isday = TheWorld:HasTag("cave") and TheWorld.components.worldstate.data.iscaveday or TheWorld.components.worldstate.data.isday

 

Link to comment
Share on other sites

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
 Share

×
  • Create New...