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

◆ OnAction()

override bool OnAction ( int action_id,
Man player,
ParamsReadContext ctx )
protected

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

2359 {
2360 super.OnAction(action_id, player, ctx);
2361
2362 if (g_Game.IsClient() || !g_Game.IsMultiplayer())
2363 {
2364 switch (action_id)
2365 {
2366 case EActions.GIZMO_OBJECT:
2367 if (GetGizmoApi())
2368 GetGizmoApi().SelectObject(this);
2369 return true;
2370 case EActions.GIZMO_PHYSICS:
2371 if (GetGizmoApi())
2372 GetGizmoApi().SelectPhysics(GetPhysics());
2373 return true;
2374 }
2375 }
2376
2377 if (g_Game.IsServer())
2378 {
2379 switch (action_id)
2380 {
2381 case EActions.DELETE:
2382 Delete();
2383 return true;
2384 }
2385 }
2386
2387 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
2388 {
2389 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
2390 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
2391 PlayerBase p = PlayerBase.Cast(player);
2392 if (EActions.RECIPES_RANGE_START < 1000)
2393 {
2394 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
2395 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
2396 }
2397 }
2398 #ifndef SERVER
2399 else if (action_id == EActions.WATCH_PLAYER)
2400 {
2401 PluginDeveloper.SetDeveloperItemClientEx(player);
2402 }
2403 #endif
2404 if (g_Game.IsServer())
2405 {
2406 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
2407 {
2408 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
2409 OnDebugButtonPressServer(id + 1);
2410 }
2411
2412 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
2413 {
2414 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
2415 InsertAgent(agent_id,100);
2416 }
2417
2418 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
2419 {
2420 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
2421 RemoveAgent(agent_id2);
2422 }
2423
2424 else if (action_id == EActions.ADD_QUANTITY)
2425 {
2426 if (IsMagazine())
2427 {
2428 Magazine mag = Magazine.Cast(this);
2429 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
2430 }
2431 else
2432 {
2433 AddQuantity(GetQuantityMax() * 0.2);
2434 }
2435
2436 if (m_EM)
2437 {
2438 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
2439 }
2440 //PrintVariables();
2441 }
2442
2443 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
2444 {
2445 if (IsMagazine())
2446 {
2447 Magazine mag2 = Magazine.Cast(this);
2448 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
2449 }
2450 else
2451 {
2452 AddQuantity(- GetQuantityMax() * 0.2);
2453 }
2454 if (m_EM)
2455 {
2456 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
2457 }
2458 //PrintVariables();
2459 }
2460
2461 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
2462 {
2463 SetQuantity(0);
2464
2465 if (m_EM)
2466 {
2467 m_EM.SetEnergy(0);
2468 }
2469 }
2470
2471 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
2472 {
2474
2475 if (m_EM)
2476 {
2477 m_EM.SetEnergy(m_EM.GetEnergyMax());
2478 }
2479 }
2480
2481 else if (action_id == EActions.ADD_HEALTH)
2482 {
2483 AddHealth("","",GetMaxHealth("","Health")/5);
2484 }
2485 else if (action_id == EActions.REMOVE_HEALTH)
2486 {
2487 AddHealth("","",-GetMaxHealth("","Health")/5);
2488 }
2489 else if (action_id == EActions.DESTROY_HEALTH)
2490 {
2491 SetHealth01("","",0);
2492 }
2493 else if (action_id == EActions.WATCH_ITEM)
2494 {
2496 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
2497 #ifdef DEVELOPER
2498 SetDebugDeveloper_item(this);
2499 #endif
2500 }
2501
2502 else if (action_id == EActions.ADD_TEMPERATURE)
2503 {
2504 AddTemperature(20);
2505 //PrintVariables();
2506 }
2507
2508 else if (action_id == EActions.REMOVE_TEMPERATURE)
2509 {
2510 AddTemperature(-20);
2511 //PrintVariables();
2512 }
2513
2514 else if (action_id == EActions.FLIP_FROZEN)
2515 {
2516 SetFrozen(!GetIsFrozen());
2517 //PrintVariables();
2518 }
2519
2520 else if (action_id == EActions.ADD_WETNESS)
2521 {
2522 AddWet(GetWetMax()/5);
2523 //PrintVariables();
2524 }
2525
2526 else if (action_id == EActions.REMOVE_WETNESS)
2527 {
2528 AddWet(-GetWetMax()/5);
2529 //PrintVariables();
2530 }
2531
2532 else if (action_id == EActions.LIQUIDTYPE_UP)
2533 {
2534 int curr_type = GetLiquidType();
2535 SetLiquidType(curr_type * 2);
2536 //AddWet(1);
2537 //PrintVariables();
2538 }
2539
2540 else if (action_id == EActions.LIQUIDTYPE_DOWN)
2541 {
2542 int curr_type2 = GetLiquidType();
2543 SetLiquidType(curr_type2 / 2);
2544 }
2545
2546 else if (action_id == EActions.MAKE_SPECIAL)
2547 {
2548 auto debugParams = DebugSpawnParams.WithPlayer(player);
2549 OnDebugSpawnEx(debugParams);
2550 }
2551
2552 }
2553
2554
2555 return false;
2556 }
override void SetQuantity()
Определения ConstructionInfoIcons.c:298
DayZGame g_Game
Определения DayZGame.c:4074
EActions
Определения EActions.c:2
proto GizmoApi GetGizmoApi()
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:3984
override float GetWetMax()
Определения ItemBase.c:3722
override void RemoveAgent(int agent_id)
Определения ItemBase.c:3965
void SetQuantityMax()
Определения ItemBase.c:3394
override int GetLiquidType()
Определения ItemBase.c:3883
override void AddWet(float value)
Определения ItemBase.c:3707
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:3389
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:3867
override int GetQuantityMax()
Определения ItemBase.c:3435
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:326
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
Определения PlayerBaseClient.c:2

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