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

◆ OnAction()

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

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

2398 {
2399 super.OnAction(action_id, player, ctx);
2400
2401 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
2402 {
2403 switch (action_id)
2404 {
2405 case EActions.GIZMO_OBJECT:
2406 GetGame().GizmoSelectObject(this);
2407 return true;
2408 case EActions.GIZMO_PHYSICS:
2409 GetGame().GizmoSelectPhysics(GetPhysics());
2410 return true;
2411 }
2412 }
2413
2414 if (GetGame().IsServer())
2415 {
2416 switch (action_id)
2417 {
2418 case EActions.DELETE:
2419 Delete();
2420 return true;
2421 }
2422 }
2423
2424 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
2425 {
2426 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
2427 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
2428 PlayerBase p = PlayerBase.Cast(player);
2429 if (EActions.RECIPES_RANGE_START < 1000)
2430 {
2431 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
2432 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
2433 }
2434 }
2435 #ifndef SERVER
2436 else if (action_id == EActions.WATCH_PLAYER)
2437 {
2438 PluginDeveloper.SetDeveloperItemClientEx(player);
2439 }
2440 #endif
2441 if (GetGame().IsServer())
2442 {
2443 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
2444 {
2445 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
2446 OnDebugButtonPressServer(id + 1);
2447 }
2448
2449 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
2450 {
2451 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
2452 InsertAgent(agent_id,100);
2453 }
2454
2455 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
2456 {
2457 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
2458 RemoveAgent(agent_id2);
2459 }
2460
2461 else if (action_id == EActions.ADD_QUANTITY)
2462 {
2463 if (IsMagazine())
2464 {
2465 Magazine mag = Magazine.Cast(this);
2466 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
2467 }
2468 else
2469 {
2470 AddQuantity(GetQuantityMax() * 0.2);
2471 }
2472
2473 if (m_EM)
2474 {
2475 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
2476 }
2477 //PrintVariables();
2478 }
2479
2480 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
2481 {
2482 if (IsMagazine())
2483 {
2484 Magazine mag2 = Magazine.Cast(this);
2485 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
2486 }
2487 else
2488 {
2489 AddQuantity(- GetQuantityMax() * 0.2);
2490 }
2491 if (m_EM)
2492 {
2493 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
2494 }
2495 //PrintVariables();
2496 }
2497
2498 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
2499 {
2500 SetQuantity(0);
2501
2502 if (m_EM)
2503 {
2504 m_EM.SetEnergy(0);
2505 }
2506 }
2507
2508 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
2509 {
2511
2512 if (m_EM)
2513 {
2514 m_EM.SetEnergy(m_EM.GetEnergyMax());
2515 }
2516 }
2517
2518 else if (action_id == EActions.ADD_HEALTH)
2519 {
2520 AddHealth("","",GetMaxHealth("","Health")/5);
2521 }
2522 else if (action_id == EActions.REMOVE_HEALTH)
2523 {
2524 AddHealth("","",-GetMaxHealth("","Health")/5);
2525 }
2526 else if (action_id == EActions.DESTROY_HEALTH)
2527 {
2528 SetHealth01("","",0);
2529 }
2530 else if (action_id == EActions.WATCH_ITEM)
2531 {
2533 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
2534 #ifdef DEVELOPER
2535 SetDebugDeveloper_item(this);
2536 #endif
2537 }
2538
2539 else if (action_id == EActions.ADD_TEMPERATURE)
2540 {
2541 AddTemperature(20);
2542 //PrintVariables();
2543 }
2544
2545 else if (action_id == EActions.REMOVE_TEMPERATURE)
2546 {
2547 AddTemperature(-20);
2548 //PrintVariables();
2549 }
2550
2551 else if (action_id == EActions.FLIP_FROZEN)
2552 {
2553 SetFrozen(!GetIsFrozen());
2554 //PrintVariables();
2555 }
2556
2557 else if (action_id == EActions.ADD_WETNESS)
2558 {
2559 AddWet(GetWetMax()/5);
2560 //PrintVariables();
2561 }
2562
2563 else if (action_id == EActions.REMOVE_WETNESS)
2564 {
2565 AddWet(-GetWetMax()/5);
2566 //PrintVariables();
2567 }
2568
2569 else if (action_id == EActions.LIQUIDTYPE_UP)
2570 {
2571 int curr_type = GetLiquidType();
2572 SetLiquidType(curr_type * 2);
2573 //AddWet(1);
2574 //PrintVariables();
2575 }
2576
2577 else if (action_id == EActions.LIQUIDTYPE_DOWN)
2578 {
2579 int curr_type2 = GetLiquidType();
2580 SetLiquidType(curr_type2 / 2);
2581 }
2582
2583 else if (action_id == EActions.MAKE_SPECIAL)
2584 {
2585 auto debugParams = DebugSpawnParams.WithPlayer(player);
2586 OnDebugSpawnEx(debugParams);
2587 }
2588
2589 }
2590
2591
2592 return false;
2593 }
EActions
Определения EActions.c:2
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
proto native void GizmoSelectObject(Object object)
proto native void GizmoSelectPhysics(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:3362
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:3955
override int GetQuantityMax()
Определения ItemBase.c:3408
void SetQuantityMax()
Определения ItemBase.c:3367
override int GetLiquidType()
Определения ItemBase.c:3849
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:3308
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:3833
void ItemBase()
Определения ItemBase.c:140
override void RemoveAgent(int agent_id)
Определения ItemBase.c:3936
override float GetWetMax()
Определения ItemBase.c:3681
override void AddWet(float value)
Определения ItemBase.c:3666
proto native CGame GetGame()

Перекрестные ссылки AddQuantity(), AddWet(), GetGame(), GetLiquidType(), GetPlugin(), GetQuantityMax(), GetWetMax(), CGame::GizmoSelectObject(), CGame::GizmoSelectPhysics(), InsertAgent(), ItemBase(), PluginItemDiagnostic(), RemoveAgent(), SetLiquidType(), ItemBase::SetQuantity() и SetQuantityMax().