Skip to content

Commit

Permalink
Fixes:
Browse files Browse the repository at this point in the history
    action on stacks of Carcasses
    sprite desync when pushing
  • Loading branch information
Mikhael-Danilov committed Dec 17, 2024
1 parent b071188 commit ccfceb0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public ArrayList<String> actions(Char hero) {
public void _execute(@NotNull Char chr, @NotNull String action){
if(action.equals(AC_KICK)) {
GLog.i(Utils.format(R.string.Carcass_Kick, src.getName()));
removeItem();
consumedOneBy(chr);
}

if (action.equals(AC_NECROMANCY)) {
Expand All @@ -137,7 +137,7 @@ public void _execute(@NotNull Char chr, @NotNull String action){
Buff.detach(chr, Sungrass.Health.class);

if (level.cellValid(spawnPos)) {
var pet = Mob.makePet((Mob) src, chr.getId());
var pet = Mob.makePet((Mob) src.makeClone(), chr.getId());
pet.regenSprite();
pet.assigndNextId();
pet.setUndead(true);
Expand All @@ -149,24 +149,13 @@ public void _execute(@NotNull Char chr, @NotNull String action){
} else {
GLog.n(Utils.format(R.string.Carcass_Necromancy_Failed, src.getName()));
}

if(getHeap()!=null) {
removeItem();
} else {
detach(chr.getBelongings().backpack, 1);
}
consumedOneBy(chr);

} else if (action.equals(AC_DEVOUR)) {
Devour.hit(chr);
chr.eat(this, src.ht(), Utils.format(R.string.Carcass_Devoured, src.getName()));
chr.heal(src.ht()/10, this);

if(getHeap()!=null) {
removeItem();
} else {
detach(chr.getBelongings().backpack, 1);
}

} else {
super._execute(chr, action);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ public void setExp(int exp) {

@Override
public void eat(@NotNull Item food, float energy, String message) {
food.detach(getBelongings().backpack);
food.consumedOneBy(this);

hunger().satisfy(energy);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public void update() {
sprite.setY(getY());
} else {
GLog.debug("pushing %s (%d) %d->%d complete", ch, ch.getPos(), from, to);
sprite.point( end );
killAndErase();
Actor.remove( Pushing.this );
ch.setPos(to);
ch.placeTo(to);
sprite.place(to);
next();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,14 @@ public void removeItem() {
Actor.remove(this);
}

public void consumedOneBy(Char chr) {
if(heap!=null) {
heap.pickUp();
} else {
detach(chr.getBelongings().backpack);
}
}

@LuaInterface
public void setChargeKnown(boolean chargeKnown) {} //RA compatibility

Expand Down

0 comments on commit ccfceb0

Please sign in to comment.