actor.game_pos = game_pos
actor.anchor = (0, 0)
return actor
+
+
+def clone_old_item(item, **new_data):
+ new_item = {
+ "type": item.item_type,
+ "pos": item.game_pos,
+ }
+ new_item.update(item.item_data)
+ new_item.update(new_data)
+ return get_item(new_item)
from .base import (
Scene, ChangeSceneEvent, MoveViewportEvent, WorldEvent, defer_to_update)
from ..constants import TILE_SIZE, WIDTH, HEIGHT
+from ..gamelib.items import clone_old_item
from ..roaches import build_roach
from ..vehicles.base import Vehicle
if item.item_type == "serum":
world.serums.append(item.item_data["serum"])
elif item.item_type == "weapon":
+ old_weapon = world.weapons.current
world.weapons.current = item.item_data["weapon"]
+ if old_weapon != "spit":
+ clone = clone_old_item(item, weapon=old_weapon)
+ self._level.items.append(clone)
+ self._items.add(clone)
self._vehicle_changed()
@defer_to_update