forked from OpenWF/SpaceNinjaServer
		
	fix: instantly finish free dojo decos (e.g. obstacle course gates) (#1321)
Reviewed-on: OpenWF/SpaceNinjaServer#1321
This commit is contained in:
		
							parent
							
								
									3ba58114b9
								
							
						
					
					
						commit
						31c1fc245f
					
				@ -24,17 +24,25 @@ export const placeDecoInComponentController: RequestHandler = async (req, res) =
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    component.Decos ??= [];
 | 
			
		||||
    component.Decos.push({
 | 
			
		||||
        _id: new Types.ObjectId(),
 | 
			
		||||
        Type: request.Type,
 | 
			
		||||
        Pos: request.Pos,
 | 
			
		||||
        Rot: request.Rot,
 | 
			
		||||
        Name: request.Name
 | 
			
		||||
    });
 | 
			
		||||
    const deco =
 | 
			
		||||
        component.Decos[
 | 
			
		||||
            component.Decos.push({
 | 
			
		||||
                _id: new Types.ObjectId(),
 | 
			
		||||
                Type: request.Type,
 | 
			
		||||
                Pos: request.Pos,
 | 
			
		||||
                Rot: request.Rot,
 | 
			
		||||
                Name: request.Name
 | 
			
		||||
            }) - 1
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
    const meta = Object.values(ExportDojoRecipes.decos).find(x => x.resultType == request.Type);
 | 
			
		||||
    if (meta && meta.capacityCost) {
 | 
			
		||||
        component.DecoCapacity -= meta.capacityCost;
 | 
			
		||||
    if (meta) {
 | 
			
		||||
        if (meta.capacityCost) {
 | 
			
		||||
            component.DecoCapacity -= meta.capacityCost;
 | 
			
		||||
        }
 | 
			
		||||
        if (meta.price == 0 && meta.ingredients.length == 0) {
 | 
			
		||||
            deco.CompletionTime = new Date();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    await guild.save();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user