From 30e4b336fafbb11a74de566a36e7f5c9d198af84 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Wed, 26 Jul 2017 01:48:23 -0400 Subject: [PATCH] Remove comments --- crafting.lua | 138 ++++----------------------------------------------- 1 file changed, 10 insertions(+), 128 deletions(-) diff --git a/crafting.lua b/crafting.lua index 5e336e4..988ccff 100644 --- a/crafting.lua +++ b/crafting.lua @@ -154,6 +154,7 @@ function crafting.move_items() local left = love.mouse.isDown(1) local right = love.mouse.isDown(2) --split stack in half + --left click if crafting_open == true then if left and old_left_mouse == false then --the full inventory @@ -163,24 +164,6 @@ function crafting.move_items() crafting.held_item["id"] = inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)]["id"] crafting.held_item["count"] = inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)]["count"] inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)] = {} - --[[ - print("removeing") - local old_slot = inventory[selected_slot] - - inventory_remove(selected_slot,nil) - - selected_slot = - - inventory_add(old_slot["id"],selected_slot) - - crafting_selection_x,crafting_selection_y = -1,-1 - selected_slot = -1 - - old_selected_slot = selected_slot - ]]-- - --else - -- print("test") - -- selected_slot = crafting_selection_x + ((crafting_selection_y-1) * inventory_size) else if not inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)]["id"] then inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)]["id"] = crafting.held_item["id"] @@ -199,24 +182,6 @@ function crafting.move_items() crafting.held_item["id"] = crafting.craft_inventory[(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))]["id"] crafting.held_item["count"] = crafting.craft_inventory[(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))]["count"] crafting.craft_inventory[(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))] = {} - --[[ - print("removeing") - local old_slot = inventory[selected_slot] - - inventory_remove(selected_slot,nil) - - selected_slot = - - inventory_add(old_slot["id"],selected_slot) - - crafting_selection_x,crafting_selection_y = -1,-1 - selected_slot = -1 - - old_selected_slot = selected_slot - ]]-- - --else - -- print("test") - -- selected_slot = crafting_selection_x + ((crafting_selection_y-1) * inventory_size) else if not crafting.craft_inventory[(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))]["id"] then --print("test2") @@ -230,40 +195,18 @@ function crafting.move_items() --only allow grabbing from output elseif craft_output_selection_x > 0 and craft_output_selection_y > 0 then - --if not crafting.held_item["id"] then + if not crafting.held_item["id"] then -- --print("nothing here: "..(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))) - -- crafting.held_item["id"] = crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["id"] - -- crafting.held_item["count"] = crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["count"] - -- crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))] = {} - --[[ - print("removeing") - local old_slot = inventory[selected_slot] - - inventory_remove(selected_slot,nil) - - selected_slot = - - inventory_add(old_slot["id"],selected_slot) - - crafting_selection_x,crafting_selection_y = -1,-1 - selected_slot = -1 - - old_selected_slot = selected_slot - ]]-- - --else - -- print("test") - -- selected_slot = crafting_selection_x + ((crafting_selection_y-1) * inventory_size) - --else - if not crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["id"] then - --print("test2") - crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["id"] = crafting.held_item["id"] - crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["count"] = crafting.held_item["count"] - - crafting.held_item = {} - end - --end + crafting.held_item["id"] = crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["id"] + crafting.held_item["count"] = crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["count"] + crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))] = {} + end end + + + --right click + --place 1 or split stack elseif right and old_right_mouse == false then --the full inventory @@ -274,24 +217,6 @@ function crafting.move_items() crafting.held_item["count"] = math.floor(inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)]["count"]/2) inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)]["count"] = math.ceil(inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)]["count"]/2) - --[[ - print("removeing") - local old_slot = inventory[selected_slot] - - inventory_remove(selected_slot,nil) - - selected_slot = - - inventory_add(old_slot["id"],selected_slot) - - crafting_selection_x,crafting_selection_y = -1,-1 - selected_slot = -1 - - old_selected_slot = selected_slot - ]]-- - --else - -- print("test") - -- selected_slot = crafting_selection_x + ((crafting_selection_y-1) * inventory_size) else if not inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)]["id"] then inventory[crafting_selection_x + ((crafting_selection_y-1) * inventory_size)]["id"] = crafting.held_item["id"] @@ -310,24 +235,6 @@ function crafting.move_items() crafting.held_item["id"] = crafting.craft_inventory[(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))]["id"] crafting.held_item["count"] = math.floor(crafting.craft_inventory[(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))]["count"]/2) crafting.craft_inventory[(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))]["count"] = math.ceil(crafting.craft_inventory[(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))]["count"]/2) - --[[ - print("removeing") - local old_slot = inventory[selected_slot] - - inventory_remove(selected_slot,nil) - - selected_slot = - - inventory_add(old_slot["id"],selected_slot) - - crafting_selection_x,crafting_selection_y = -1,-1 - selected_slot = -1 - - old_selected_slot = selected_slot - ]]-- - --else - -- print("test") - -- selected_slot = crafting_selection_x + ((crafting_selection_y-1) * inventory_size) else if not crafting.craft_inventory[(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))]["id"] then --print("test2") @@ -340,31 +247,6 @@ function crafting.move_items() --only allow grabbing from output elseif craft_output_selection_x > 0 and craft_output_selection_y > 0 then - - --if not crafting.held_item["id"] then - -- --print("nothing here: "..(craft_inventory_selection_x + ((craft_inventory_selection_y-1) * crafting.craft_size))) - -- crafting.held_item["id"] = crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["id"] - -- crafting.held_item["count"] = crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["count"] - -- crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))] = {} - --[[ - print("removeing") - local old_slot = inventory[selected_slot] - - inventory_remove(selected_slot,nil) - - selected_slot = - - inventory_add(old_slot["id"],selected_slot) - - crafting_selection_x,crafting_selection_y = -1,-1 - selected_slot = -1 - - old_selected_slot = selected_slot - ]]-- - --else - -- print("test") - -- selected_slot = crafting_selection_x + ((crafting_selection_y-1) * inventory_size) - --else if not crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["id"] then --print("test2") crafting.output_inventory[(craft_output_selection_x + ((craft_output_selection_y-1) * 1))]["id"] = crafting.held_item["id"]