starlit  Diff

Differences From Artifact [7112e6c94b]:

To Artifact [7f11ba51a8]:


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
..
86
87
88
89
90
91
92

93
94
95
96
97
98
99
...
108
109
110
111
112
113
114

115
116
117
118

119
120
121
122
123
124
125
126
127
128
...
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
			return w
		end;
		onReconfigure = function(self, inv)
			-- apply any changes to item metadata and export any subinventories
			-- to the provided invref, as they may have changed
			local sc = starlit.item.container(self.item, inv, {pfx = 'starlit_suit'})
			sc:push()
			self:pullCanisters(inv)
		end;
		onItemMove = function(self, user, list, act, what)
			-- called when the suit inventory is changed
			if act == 'put' then
				if list == 'starlit_suit_bat' then
					user:suitSound('starlit-suit-battery-in')
				elseif list == 'starlit_suit_chips' then
................................................................................
					user:suitSound('starlit-insert-snap')
				end
			end
		end;
		def = function(self)
			return self.item:get_definition()._starlit.suit
		end;

		pullCanisters = function(self, inv)
			starlit.item.container.dropPrefix(inv, 'starlit_canister')
			self:forCanisters(inv, function(sc) sc:pull() end)
		end;
		pushCanisters = function(self, inv, st, i)
			self:forCanisters(inv, function(sc)
				sc:push()
................................................................................
					local sc = starlit.item.container(st, inv, {pfx = pfx})
					if fn(sc, st, i, pfx) then
						inv:set_stack('starlit_suit_canisters', i, st)
					end
				end
			end end
		end;

		establishInventories = function(self, obj)
			local inv = obj:get_inventory()
			local ct = suitContainer(self.item, inv)
			ct:pull()

			self:pullCanisters(inv)

			--[[
			local def = self:def()
			local sst = suitStore(self.item)
			local function readList(listName, prop)
				inv:set_size(listName, def.slots[prop])
				if def.slots[prop] > 0 then
					local lst = sst.read(prop)
					inv:set_list(listName, lst)
................................................................................
		on_use = function(st, luser, pointed)
			local user = starlit.activeUsers[luser:get_player_name()]
			if not user then return end
			-- have mercy on users who've lost their suits and wound
			-- up naked and dying of exposure
			if user:naked() then
				local ss = st:take_item(1)
				user:setSuit(starlit.type.suit(ss))
				user:suitSound('starlit-suit-don')
				return st
			end
		end;
		inventory_image = icon:render();
		_starlit = {
			container = {







|







 







>







 







>




>


<







 







|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
..
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

124
125
126
127
128
129
130
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
			return w
		end;
		onReconfigure = function(self, inv)
			-- apply any changes to item metadata and export any subinventories
			-- to the provided invref, as they may have changed
			local sc = starlit.item.container(self.item, inv, {pfx = 'starlit_suit'})
			sc:push()
-- 			self:pullCanisters(inv)
		end;
		onItemMove = function(self, user, list, act, what)
			-- called when the suit inventory is changed
			if act == 'put' then
				if list == 'starlit_suit_bat' then
					user:suitSound('starlit-suit-battery-in')
				elseif list == 'starlit_suit_chips' then
................................................................................
					user:suitSound('starlit-insert-snap')
				end
			end
		end;
		def = function(self)
			return self.item:get_definition()._starlit.suit
		end;
		--[[
		pullCanisters = function(self, inv)
			starlit.item.container.dropPrefix(inv, 'starlit_canister')
			self:forCanisters(inv, function(sc) sc:pull() end)
		end;
		pushCanisters = function(self, inv, st, i)
			self:forCanisters(inv, function(sc)
				sc:push()
................................................................................
					local sc = starlit.item.container(st, inv, {pfx = pfx})
					if fn(sc, st, i, pfx) then
						inv:set_stack('starlit_suit_canisters', i, st)
					end
				end
			end end
		end;
		]]
		establishInventories = function(self, obj)
			local inv = obj:get_inventory()
			local ct = suitContainer(self.item, inv)
			ct:pull()
			--[[
			self:pullCanisters(inv)


			local def = self:def()
			local sst = suitStore(self.item)
			local function readList(listName, prop)
				inv:set_size(listName, def.slots[prop])
				if def.slots[prop] > 0 then
					local lst = sst.read(prop)
					inv:set_list(listName, lst)
................................................................................
		on_use = function(st, luser, pointed)
			local user = starlit.activeUsers[luser:get_player_name()]
			if not user then return end
			-- have mercy on users who've lost their suits and wound
			-- up naked and dying of exposure
			if user:naked() then
				local ss = st:take_item(1)
				user:changeSuit(starlit.type.suit(ss))
				user:suitSound('starlit-suit-don')
				return st
			end
		end;
		inventory_image = icon:render();
		_starlit = {
			container = {