diff --git a/objects/obj_chunk.object.gmx b/objects/obj_chunk.object.gmx index 7cf9804..ac6535b 100644 --- a/objects/obj_chunk.object.gmx +++ b/objects/obj_chunk.object.gmx @@ -116,7 +116,6 @@ if(obj_inv_controller.is_open) } var selected_item = obj_inv_controller.inventory[obj_hotbar.selected_slot]; -var has_colision = false; if(selected_item != 0) { @@ -124,33 +123,23 @@ if(selected_item != 0) var selY = round(mouse_y/TILE_SIZE)*TILE_SIZE; selX -= TILE_SIZE / 2; selY -= TILE_SIZE / 2; - - for(var xx = selX; xx < selX + TILE_SIZE; xx++) - { - for(yy = selY; yy < selY + TILE_SIZE; yy++) - { - var objid = instance_place(xx,yy,obj_placed_item) - if(objid != noone) - { - has_colision = true; - } - - var objid = instance_place(xx,yy,obj_player) - if(objid != noone) - { - has_colision = true; - } - - - } - } - if(has_colision) + + var objid = instance_position(selX,selY,obj_placed_item) + if(objid != noone) { + show_debug_message(string(objid)+", "+string(objid.object_index)); + return 0; + } + + objid = instance_position(selX,selY,obj_player) + if(objid != noone) + { + show_debug_message(string(objid)+", "+string(objid.object_index)); return 0; } - use_item_in_inventory(obj_hotbar.selected_slot); var inst = instance_create(selX,selY,obj_placed_item); + use_item_in_inventory(obj_hotbar.selected_slot); var chunkid = id; with(inst){ inst.ITEM_ID = selected_item;