[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / actions / PlaceBlockActionUtils.kt
1 package ru.deadsoftware.cavedroid.game.actions
3 import com.badlogic.gdx.Gdx
4 import ru.deadsoftware.cavedroid.game.actions.useitem.IUseItemAction
5 import ru.deadsoftware.cavedroid.game.actions.useitem.PlaceBlockItemToBackgroundAction
6 import ru.deadsoftware.cavedroid.game.actions.useitem.PlaceBlockItemToForegroundAction
7 import ru.deadsoftware.cavedroid.game.objects.Item
9 private const val TAG = "PlaceBlockActionUtils"
11 fun Map<String, IUseItemAction>.placeToForegroundAction(item: Item, x: Int, y: Int) {
12 get(PlaceBlockItemToForegroundAction.ACTION_KEY)?.perform(item, x, y)
13 ?: Gdx.app.error(TAG, "action place_foreground_block not found")
14 }
16 fun Map<String, IUseItemAction>.placeToBackgroundAction(item: Item, x: Int, y: Int) {
17 get(PlaceBlockItemToBackgroundAction.ACTION_KEY)?.perform(item, x, y)
18 ?: Gdx.app.error(TAG, "action place_background_block not found")
19 }