Skip to content

Commit 142c0ba

Browse files
Items on timeline
1 parent 1f0c6cc commit 142c0ba

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed

RemixedDungeon/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ android {
3333
manifestPlaceholders = ["admob_app_id":getApiField("admob_app_id")]
3434

3535
applicationId "com.nyrds.pixeldungeon.ml"
36-
versionCode 1217
37-
versionName "32.1.beta.10"
36+
versionCode 1218
37+
versionName "32.1.beta.1"
3838
targetSdkVersion 34
3939
compileSdkVersion 34
4040
minSdkVersion 21

RemixedDungeon/src/main/java/com/watabou/pixeldungeon/actors/Actor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public void postpone(float time) {
7474
this.time = now + time;
7575
}
7676

77-
protected float cooldown() {
77+
@LuaInterface
78+
public float cooldown() {
7879
return time - now;
7980
}
8081

@@ -409,6 +410,9 @@ private static void add(Actor actor, float time) {
409410

410411
chars.put(ch.getPos(), ch);
411412
all.addAll(ch.buffs());
413+
for (var item : ch.getBelongings()) {
414+
all.add(item);
415+
}
412416
}
413417

414418

RemixedDungeon/src/main/java/com/watabou/pixeldungeon/actors/hero/Belongings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public Char getOwner() {
486486
return owner;
487487
}
488488

489-
private class ItemIterator implements Iterator<Item> {
489+
public class ItemIterator implements Iterator<Item> {
490490

491491
private int index = 0;
492492

RemixedDungeon/src/main/java/com/watabou/pixeldungeon/items/Item.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ public final Item detachAll(@NotNull Bag container) {
317317

318318
protected void onDetach() {
319319
setOwner(CharsList.DUMMY);
320+
Actor.remove(this);
320321
}
321322

322323
public Item upgrade() {
@@ -495,13 +496,14 @@ protected boolean act() {
495496

496497
@Override
497498
public void storeInBundle(Bundle bundle) {
499+
super.storeInBundle(bundle);
498500
bundle.put(QUANTITY, quantity());
499501
bundle.put(LEVEL, level());
500502
}
501503

502504
@Override
503505
public void restoreFromBundle(Bundle bundle) {
504-
506+
super.restoreFromBundle(bundle);
505507
getId();
506508

507509
quantity(bundle.getInt(QUANTITY));
@@ -513,6 +515,7 @@ public void restoreFromBundle(Bundle bundle) {
513515
degrade(-level);
514516
}
515517

518+
setOwner(getOwner());
516519
//We still need this because upgrade erase cursed flag
517520
setCursed(bundle.optBoolean("cursed", false));
518521

@@ -781,6 +784,7 @@ public void ownerDoesDamage(int damage) {
781784
}
782785

783786
public void setOwner(Char owner) {
787+
GLog.debug("%s owner %s", getEntityKind(), owner.getEntityKind());
784788
Actor.add(this);
785789
this.owner = owner;
786790
if (owner.valid()) {
@@ -822,5 +826,6 @@ public void removeItem() {
822826

823827
owner.getBelongings().removeItem(this);
824828
}
829+
Actor.remove(this);
825830
}
826831
}

RemixedDungeon/src/main/java/com/watabou/pixeldungeon/items/bags/Bag.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,12 @@ public void remove() {
210210
public String getEntityKind() {
211211
return getClass().getSimpleName();
212212
}
213+
214+
@Override
215+
public void setOwner(Char owner) {
216+
super.setOwner(owner);
217+
for(Item i:items) {
218+
i.setOwner(owner);
219+
}
220+
}
213221
}

RemixedDungeon/src/main/java/com/watabou/pixeldungeon/windows/WndItem.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.nyrds.pixeldungeon.windows.VHBox;
1010
import com.nyrds.platform.util.StringsManager;
1111
import com.nyrds.util.GuiProperties;
12+
import com.nyrds.util.Util;
1213
import com.watabou.noosa.Text;
1314
import com.watabou.pixeldungeon.actors.Char;
1415
import com.watabou.pixeldungeon.items.Item;
@@ -44,6 +45,9 @@ public WndItem(final WndBag bag, final Item item) {
4445
}
4546

4647
Text info = PixelScene.createMultiline(item.info(), GuiProperties.regularFontSize());
48+
if(Util.isDebug()) {
49+
info.text(info.text()+Utils.format("\ncooldown %.1f\nowner %s",item.cooldown(),item.getOwner().getEntityKind()));
50+
}
4751
info.maxWidth(WIDTH);
4852
info.setX(titlebar.left());
4953
info.setY(titlebar.bottom() + GAP);

0 commit comments

Comments
 (0)