mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +01:00
Make pets unstay after 120 seconds
This commit is contained in:
parent
87141be688
commit
35446586e0
@ -46,6 +46,7 @@ public class Pet implements ISerialize, Runnable {
|
||||
private int gestureTickTimeout = Emulator.getIntUnixTimestamp();
|
||||
private int randomActionTickTimeout = Emulator.getIntUnixTimestamp();
|
||||
private int postureTimeout = Emulator.getIntUnixTimestamp();
|
||||
private int stayStartedAt = 0;
|
||||
private int idleCommandTicks = 0;
|
||||
private int freeCommandTicks = -1;
|
||||
|
||||
@ -276,6 +277,11 @@ public class Pet implements ISerialize, Runnable {
|
||||
|
||||
this.tickTimeout = time;
|
||||
}
|
||||
|
||||
if (this.task == PetTasks.STAY && Emulator.getIntUnixTimestamp() - this.stayStartedAt >= 120) {
|
||||
this.task = null;
|
||||
this.getRoomUnit().setCanWalk(true);
|
||||
}
|
||||
} else {
|
||||
int timeout = Emulator.getRandom().nextInt(10) * 2;
|
||||
this.roomUnit.setWalkTimeOut(timeout < 20 ? 20 + time : timeout + time);
|
||||
@ -331,6 +337,12 @@ public class Pet implements ISerialize, Runnable {
|
||||
public void handleCommand(PetCommand command, Habbo habbo, String[] data) {
|
||||
this.idleCommandTicks = 0;
|
||||
|
||||
if (this.task == PetTasks.STAY) {
|
||||
this.stayStartedAt = 0;
|
||||
this.task = null;
|
||||
this.getRoomUnit().setCanWalk(true);
|
||||
}
|
||||
|
||||
command.handle(this, habbo, data);
|
||||
|
||||
|
||||
@ -731,4 +743,12 @@ public class Pet implements ISerialize, Runnable {
|
||||
this.room = null;
|
||||
this.needsUpdate = true;
|
||||
}
|
||||
|
||||
public int getStayStartedAt() {
|
||||
return stayStartedAt;
|
||||
}
|
||||
|
||||
public void setStayStartedAt(int stayStartedAt) {
|
||||
this.stayStartedAt = stayStartedAt;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.eu.habbo.habbohotel.pets.actions;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.pets.PetAction;
|
||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||
@ -20,7 +21,7 @@ public class ActionStay extends PetAction {
|
||||
pet.clearPosture();
|
||||
|
||||
pet.getRoomUnit().setCanWalk(false);
|
||||
|
||||
pet.setStayStartedAt(Emulator.getIntUnixTimestamp());
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user