mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 01:05:48 +01:00 
			
		
		
		
	Allow toolcaps to override the built-in times for dig_immediate
This commit is contained in:
		
							
								
								
									
										18
									
								
								src/tool.cpp
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/tool.cpp
									
									
									
									
									
								
							@@ -172,14 +172,16 @@ void ToolCapabilities::deserializeJson(std::istream &is)
 | 
			
		||||
DigParams getDigParams(const ItemGroupList &groups,
 | 
			
		||||
		const ToolCapabilities *tp)
 | 
			
		||||
{
 | 
			
		||||
	// Group dig_immediate has fixed time and no wear
 | 
			
		||||
	switch (itemgroup_get(groups, "dig_immediate")) {
 | 
			
		||||
	case 2:
 | 
			
		||||
		return DigParams(true, 0.5, 0, "dig_immediate");
 | 
			
		||||
	case 3:
 | 
			
		||||
		return DigParams(true, 0, 0, "dig_immediate");
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
	// Group dig_immediate defaults to fixed time and no wear
 | 
			
		||||
	if (tp->groupcaps.find("dig_immediate") == tp->groupcaps.cend()) {
 | 
			
		||||
		switch (itemgroup_get(groups, "dig_immediate")) {
 | 
			
		||||
		case 2:
 | 
			
		||||
			return DigParams(true, 0.5, 0, "dig_immediate");
 | 
			
		||||
		case 3:
 | 
			
		||||
			return DigParams(true, 0, 0, "dig_immediate");
 | 
			
		||||
		default:
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Values to be returned (with a bit of conversion)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user