DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ColourClothes()

void Barrel_ColorBase::ColourClothes ( ItemBase rci,
ItemBase gci,
ItemBase bci,
PlayerBase player )
inlineprotected

См. определение в файле Barrel_ColorBase.c строка 426

427 {
428 EntityAI item;
429 float r = 0;
430 float g = 0;
431 float b = 0;
432 float a = 1; //alpha
433 int item_count = GetInventory().GetCargo().GetItemCount();
434 bool was_colored = false;
435 if ( rci )
436 {
437 r = rci.GetQuantity()/10;
438 r = Math.Clamp(r, 0, 0.78); //TODO adjust clamp as needed, full RGB would result in a white item
439 }
440 if ( gci )
441 {
442 g = gci.GetQuantity()/10;
443 g = Math.Clamp(g, 0, 0.78);
444 }
445 if ( bci )
446 {
447 b = bci.GetQuantity()/10;
448 b = Math.Clamp(b, 0, 0.78);
449 }
450 for (int i = 0; i < item_count; i++)
451 {
452 item = GetInventory().GetCargo().GetItem(i);
453 if ( item.IsClothing() )
454 {
455 if ( GetGame().ObjectIsKindOf (item, "TShirt_White") || GetGame().ObjectIsKindOf (item, "Armband_White") )
456 {
457 ItemBase itemIB = ItemBase.Cast(item);
458 int index = itemIB.GetType().IndexOf("_");
459 string itemtype = itemIB.GetType().Substring( 0, index + 1 );
460
461 ColourClothesLambda clambda = new ColourClothesLambda(itemIB, itemtype + "Dyed", player, r, g, b, a);
462 clambda.SetTransferParams(true, true, true);
463 MiscGameplayFunctions.TurnItemIntoItemEx(player, clambda);
464 was_colored = true;
465 }
466 }
467 }
468
469 if ( was_colored )
470 {
471 if ( rci )
472 {
473 //rci.AddQuantity(-r*10,true,false);
474 rci.Delete();
475 }
476 if ( gci )
477 {
478 //gci.AddQuantity(-g*10,true,false);
479 gci.Delete();
480 }
481 if ( bci )
482 {
483 //bci.AddQuantity(-b*10,true,false);
484 bci.Delete();
485 }
486 Lock(30);
487 }
488 }
class LogManager EntityAI
class GP5GasMask extends MaskBase ItemBase
void Lock(float actiontime)
Определения Barrel_ColorBase.c:165
proto native CGame GetGame()

Перекрестные ссылки Math::Clamp(), GetGame() и Lock().

Используется в DetermineAction().