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

◆ OnAction()

override bool InventoryItem::OnAction ( int action_id,
Man player,
ParamsReadContext ctx )
inlineprotected

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

2424 {
2425 super.OnAction(action_id, player, ctx);
2426
2427 if (g_Game.IsClient() || !g_Game.IsMultiplayer())
2428 {
2429 switch (action_id)
2430 {
2431 case EActions.GIZMO_OBJECT:
2432 if (GetGizmoApi())
2433 GetGizmoApi().SelectObject(this);
2434 return true;
2435 case EActions.GIZMO_PHYSICS:
2436 if (GetGizmoApi())
2437 GetGizmoApi().SelectPhysics(GetPhysics());
2438 return true;
2439 }
2440 }
2441
2442 if (g_Game.IsServer())
2443 {
2444 switch (action_id)
2445 {
2446 case EActions.DELETE:
2447 Delete();
2448 return true;
2449 }
2450 }
2451
2452 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
2453 {
2454 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
2455 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
2456 PlayerBase p = PlayerBase.Cast(player);
2457 if (EActions.RECIPES_RANGE_START < 1000)
2458 {
2459 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
2460 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
2461 }
2462 }
2463 #ifndef SERVER
2464 else if (action_id == EActions.WATCH_PLAYER)
2465 {
2466 PluginDeveloper.SetDeveloperItemClientEx(player);
2467 }
2468 #endif
2469 if (g_Game.IsServer())
2470 {
2471 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
2472 {
2473 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
2474 OnDebugButtonPressServer(id + 1);
2475 }
2476
2477 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
2478 {
2479 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
2480 InsertAgent(agent_id,100);
2481 }
2482
2483 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
2484 {
2485 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
2486 RemoveAgent(agent_id2);
2487 }
2488
2489 else if (action_id == EActions.ADD_QUANTITY)
2490 {
2491 if (IsMagazine())
2492 {
2493 Magazine mag = Magazine.Cast(this);
2494 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
2495 }
2496 else
2497 {
2498 AddQuantity(GetQuantityMax() * 0.2);
2499 }
2500
2501 if (m_EM)
2502 {
2503 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
2504 }
2505 //PrintVariables();
2506 }
2507
2508 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
2509 {
2510 if (IsMagazine())
2511 {
2512 Magazine mag2 = Magazine.Cast(this);
2513 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
2514 }
2515 else
2516 {
2517 AddQuantity(- GetQuantityMax() * 0.2);
2518 }
2519 if (m_EM)
2520 {
2521 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
2522 }
2523 //PrintVariables();
2524 }
2525
2526 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
2527 {
2528 SetQuantity(0);
2529
2530 if (m_EM)
2531 {
2532 m_EM.SetEnergy(0);
2533 }
2534 }
2535
2536 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
2537 {
2539
2540 if (m_EM)
2541 {
2542 m_EM.SetEnergy(m_EM.GetEnergyMax());
2543 }
2544 }
2545
2546 else if (action_id == EActions.ADD_HEALTH)
2547 {
2548 AddHealth("","",GetMaxHealth("","Health")/5);
2549 }
2550 else if (action_id == EActions.REMOVE_HEALTH)
2551 {
2552 AddHealth("","",-GetMaxHealth("","Health")/5);
2553 }
2554 else if (action_id == EActions.DESTROY_HEALTH)
2555 {
2556 SetHealth01("","",0);
2557 }
2558 else if (action_id == EActions.WATCH_ITEM)
2559 {
2561 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
2562 #ifdef DEVELOPER
2563 SetDebugDeveloper_item(this);
2564 #endif
2565 }
2566
2567 else if (action_id == EActions.ADD_TEMPERATURE)
2568 {
2569 AddTemperature(20);
2570 //PrintVariables();
2571 }
2572
2573 else if (action_id == EActions.REMOVE_TEMPERATURE)
2574 {
2575 AddTemperature(-20);
2576 //PrintVariables();
2577 }
2578
2579 else if (action_id == EActions.FLIP_FROZEN)
2580 {
2581 SetFrozen(!GetIsFrozen());
2582 //PrintVariables();
2583 }
2584
2585 else if (action_id == EActions.ADD_WETNESS)
2586 {
2587 AddWet(GetWetMax()/5);
2588 //PrintVariables();
2589 }
2590
2591 else if (action_id == EActions.REMOVE_WETNESS)
2592 {
2593 AddWet(-GetWetMax()/5);
2594 //PrintVariables();
2595 }
2596
2597 else if (action_id == EActions.LIQUIDTYPE_UP)
2598 {
2599 int curr_type = GetLiquidType();
2600 SetLiquidType(curr_type * 2);
2601 //AddWet(1);
2602 //PrintVariables();
2603 }
2604
2605 else if (action_id == EActions.LIQUIDTYPE_DOWN)
2606 {
2607 int curr_type2 = GetLiquidType();
2608 SetLiquidType(curr_type2 / 2);
2609 }
2610
2611 else if (action_id == EActions.MAKE_SPECIAL)
2612 {
2613 auto debugParams = DebugSpawnParams.WithPlayer(player);
2614 OnDebugSpawnEx(debugParams);
2615 }
2616
2617 }
2618
2619
2620 return false;
2621 }
DayZGame g_Game
Определения DayZGame.c:3942
EActions
Определения EActions.c:2
proto GizmoApi GetGizmoApi()
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:325
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:3413
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:4005
override int GetQuantityMax()
Определения ItemBase.c:3459
void SetQuantityMax()
Определения ItemBase.c:3418
override int GetLiquidType()
Определения ItemBase.c:3904
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Set item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:3340
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:3888
void ItemBase()
Определения ItemBase.c:148
override void RemoveAgent(int agent_id)
Определения ItemBase.c:3986
override float GetWetMax()
Определения ItemBase.c:3736
override void AddWet(float value)
Определения ItemBase.c:3721

Перекрестные ссылки AddQuantity(), AddWet(), g_Game, GetGizmoApi(), GetLiquidType(), GetPlugin(), GetQuantityMax(), GetWetMax(), InsertAgent(), ItemBase(), PluginItemDiagnostic(), RemoveAgent(), GizmoApi::SelectObject(), GizmoApi::SelectPhysics(), SetLiquidType(), ItemBase::SetQuantity() и SetQuantityMax().