Implement Authentic Interaction Subsystem
Implemented authentic script/interaction queues This does now mean we have a total of 3 interaction systems, but this additional system is necessary to fix certain categories of bug and implement some authentic features Converted mining to new system Converted fishing to new system Converted woodcutting to new system Provided an example of soft-queued scripts with GrandTreePodListener Implemented tick-eating (it is now possible to eat a shark, drink a potion, and eat a karambwan all on the same tick) Can now eat and drop items while stunned
This commit is contained in:
@@ -23,7 +23,7 @@ public class Cake extends Food {
|
||||
player.getInventory().remove(item);
|
||||
}
|
||||
final int initialLifePoints = player.getSkills().getLifepoints();
|
||||
Consumables.getConsumableById(item.getId()).effect.activate(player);
|
||||
Consumables.getConsumableById(item.getId()).getConsumable().effect.activate(player);
|
||||
sendMessages(player, initialLifePoints, item, messages);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import core.plugin.Plugin;
|
||||
/**
|
||||
* Represents any item that has a consumption option such as 'Eat' or 'Drink'.
|
||||
*/
|
||||
public abstract class Consumable implements Plugin<Object> {
|
||||
public abstract class Consumable {
|
||||
|
||||
/**
|
||||
* Represents the item IDs of all the variants of a consumable where the last one is often the empty container, if it has any.
|
||||
@@ -58,7 +58,7 @@ public abstract class Consumable implements Plugin<Object> {
|
||||
addItem(player, nextItemId, 1, Container.INVENTORY);
|
||||
}
|
||||
final int initialLifePoints = player.getSkills().getLifepoints();
|
||||
Consumables.getConsumableById(item.getId()).effect.activate(player);
|
||||
Consumables.getConsumableById(item.getId()).getConsumable().effect.activate(player);
|
||||
sendMessages(player, initialLifePoints, item, messages);
|
||||
}
|
||||
|
||||
@@ -100,17 +100,6 @@ public abstract class Consumable implements Plugin<Object> {
|
||||
return item.getName().replace("(4)", "").replace("(3)", "").replace("(2)", "").replace("(1)", "").trim().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
Consumables.add(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object fireEvent(String identifier, Object... args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getHealthEffectValue(Player player) {
|
||||
return effect.getHealthEffectValue(player);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Potion extends Drink {
|
||||
}
|
||||
|
||||
final int initialLifePoints = player.getSkills().getLifepoints();
|
||||
Consumables.getConsumableById(item.getId()).effect.activate(player);
|
||||
Consumables.getConsumableById(item.getId()).getConsumable().effect.activate(player);
|
||||
if (messages.length == 0) {
|
||||
sendDefaultMessages(player, item);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user