Don't Starve Revision History Viewer

Comparing Six Feet Under (Rev 86935) to All's Well That Maxwell (Rev 88237)

widgets/invslot.lua

21222324252627
--generic click, with possible modifiers if TheInput:IsControlPressed(CONTROL_FORCE_INSPECT) then self:Inspect() else if TheInput:IsControlPressed(CONTROL_FORCE_TRADE) then self:TradeItem(TheInput:IsControlPressed(CONTROL_FORCE_STACK)) else
21222324252627
--generic click, with possible modifiers if TheInput:IsControlPressed(CONTROL_FORCE_INSPECT) then self:Inspect() else if TheInput:IsControlPressed(CONTROL_FORCE_TRADE) then self:TradeItem(TheInput:IsControlPressed(CONTROL_FORCE_STACK)) else
154155156157158159160161162163164165166
--if a destination container/inv is found... if dest_inst then local dest = dest_inst.components.inventory or dest_inst.components.container if dest then local item = nil --take either the item or half of its stack if container_item.components.stackable and stack_mod then item = container_item.components.stackable:Get(math.floor(container_item.components.stackable:StackSize() / 2)) if item.components.stackable.stacksize < 1 then item = nil
154155156157158159160161162163164165166
--if a destination container/inv is found... if dest_inst then local dest = dest_inst.components.inventory or dest_inst.components.container if dest then local item = nil --take either the item or half of its stack if container_item.components.stackable and stack_mod then item = container_item.components.stackable:Get(math.floor(container_item.components.stackable:StackSize() / 2)) if item.components.stackable.stacksize < 1 then item = nil
171172173174175176
end --and give it to the dest object if not dest:GiveItem(item) then container:GiveItem(item, slot_number) end
171172173174175176177
end --and give it to the dest object item.prevcontainer = nil if not dest:GiveItem(item) then container:GiveItem(item, slot_number) end