99 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			99 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|  | --[[Utils_Ui.script | ||
|  | 	The vanilla Reinit() attempted to sort the arrays by default which caused some issues with  | ||
|  | 	the display of mutant loot when the amount increased in the window. I've made the no-sorting  | ||
|  | 	an optional feature instead of the default. This is only called during mutant looting anyway, | ||
|  | 	but better safe than sorry.]] | ||
|  | function utils_ui.UICellContainer:Reinit(t, tf, nosort) | ||
|  | 	self:Reset() | ||
|  | 	 | ||
|  | 	-- If no inventory is passed, this function will just clear cells | ||
|  | 	if (not t) then | ||
|  | 		return | ||
|  | 	end | ||
|  | 	 | ||
|  | 	-- Create cells | ||
|  | 	self.ignore_scroll = true | ||
|  | 	self:Print(nil, "Reset | START Number of cells: %s", #self.cell) | ||
|  | 	 | ||
|  | 	local sort_order = self:GetSortMethod() | ||
|  | 	 | ||
|  | 	if(nosort) then | ||
|  | 		if self.showcase then | ||
|  | 			for i,sec in pairs(t) do | ||
|  | 				self:AddItem(nil,sec, tf and tf[i]) | ||
|  | 			end | ||
|  | 		else | ||
|  | 			for i,obj in pairs(t) do | ||
|  | 				self:AddItem(obj, nil, tf and tf[i]) | ||
|  | 			end | ||
|  | 		end | ||
|  | 	else | ||
|  | 		if self.showcase then | ||
|  | 			for i,sec in spairs(t, sort_order) do | ||
|  | 				self:AddItem(nil,sec, tf and tf[i]) | ||
|  | 			end | ||
|  | 		else | ||
|  | 			for i,obj in spairs(t, sort_order) do | ||
|  | 				self:AddItem(obj, nil, tf and tf[i]) | ||
|  | 			end | ||
|  | 		end | ||
|  | 		 | ||
|  | 	end | ||
|  | 	self.ignore_scroll = false | ||
|  | 	self:Print(nil, "Reset | END Number of cells: %s", #self.cell) | ||
|  | 	 | ||
|  | 	self:Scroll_Reinit() | ||
|  | end | ||
|  | 
 | ||
|  | --[[bind_crow.script | ||
|  | 	Vanilla update() used a flawed method that would always return false and prevent crows | ||
|  | 	from being lootable at all. It also was significalty less robust than Faustle's updated | ||
|  | 	bind_monster update() function, but was checking all the exact same things so I simply | ||
|  | 	ported it over. Considering my mod would have made existing fixes to crow looting | ||
|  | 	fail I implemented it myself.]] | ||
|  | function bind_crow.crow_binder:update(delta) | ||
|  | 	-- standart update | ||
|  | 	object_binder.update(self, delta) | ||
|  | 	if not (self.object:alive()) then | ||
|  | 		if (self.body_timer<=time_global()-120000) and (self.body_timer~=0) then | ||
|  | 			printf("releasing object ["..self.object:name().."]") | ||
|  | 			local se_obj = alife_object(self.object:id()) | ||
|  | 			if (se_obj) then | ||
|  | 				safe_release_manager.release(se_obj) | ||
|  | 			end | ||
|  | 		end | ||
|  | 		--Alundaio | ||
|  | 		 | ||
|  | 		-- By Faustle - Cloned over from bind_monster.script with minimial edits-tB | ||
|  | 		if not (self.object:alive()) then | ||
|  | 			local looted = se_load_var(self.object:id(),self.object:name(),"looted") | ||
|  | 			if (not looted) then | ||
|  | 				if (item_knife.is_equipped()) then | ||
|  | 					if (item_knife.get_condition() < 0.15) then | ||
|  | 						self.object:set_callback(callback.use_object, nil) | ||
|  | 						self.object:set_tip_text(game.translate_string("st_body_knife_bad")) | ||
|  | 						return | ||
|  | 					end | ||
|  | 
 | ||
|  | 					if (not item_knife.can_loot(self.object:section())) then | ||
|  | 						self.object:set_callback(callback.use_object, nil) | ||
|  | 						self.object:set_tip_text(game.translate_string("st_body_knife_weak")) | ||
|  | 					else | ||
|  | 						self.object:set_callback(callback.use_object, self.use_callback, self) | ||
|  | 						self.object:set_tip_text(game.translate_string("st_body_loot")) | ||
|  | 					end | ||
|  | 				else | ||
|  | 					self.object:set_callback(callback.use_object, nil) | ||
|  | 					self.object:set_tip_text(game.translate_string("st_body_knife_needed")) | ||
|  | 					return | ||
|  | 				end | ||
|  | 			else | ||
|  | 				self.object:set_callback(callback.use_object, nil) | ||
|  | 				self.object:set_tip_text("") | ||
|  | 			end | ||
|  | 			return | ||
|  | 		end | ||
|  | 		-- | ||
|  | 		--Alundaio | ||
|  | 	end | ||
|  | end |