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

◆ OnAction()

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

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

2347 {
2348 super.OnAction(action_id, player, ctx);
2349 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
2350 {
2351 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
2352 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
2353 PlayerBase p = PlayerBase.Cast(player);
2354 if (EActions.RECIPES_RANGE_START < 1000)
2355 {
2356 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
2357 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
2358 }
2359 }
2360 #ifndef SERVER
2361 else if (action_id == EActions.WATCH_PLAYER)
2362 {
2363 PluginDeveloper.SetDeveloperItemClientEx(player);
2364 }
2365 #endif
2366 if (GetGame().IsServer())
2367 {
2368 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
2369 {
2370 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
2371 OnDebugButtonPressServer(id + 1);
2372 }
2373
2374 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
2375 {
2376 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
2377 InsertAgent(agent_id,100);
2378 }
2379
2380 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
2381 {
2382 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
2383 RemoveAgent(agent_id2);
2384 }
2385
2386 else if (action_id == EActions.ADD_QUANTITY)
2387 {
2388 if (IsMagazine())
2389 {
2390 Magazine mag = Magazine.Cast(this);
2391 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
2392 }
2393 else
2394 {
2395 AddQuantity(GetQuantityMax() * 0.2);
2396 }
2397
2398 if (m_EM)
2399 {
2400 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
2401 }
2402 //PrintVariables();
2403 }
2404
2405 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
2406 {
2407 if (IsMagazine())
2408 {
2409 Magazine mag2 = Magazine.Cast(this);
2410 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
2411 }
2412 else
2413 {
2414 AddQuantity(- GetQuantityMax() * 0.2);
2415 }
2416 if (m_EM)
2417 {
2418 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
2419 }
2420 //PrintVariables();
2421 }
2422
2423 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
2424 {
2425 SetQuantity(0);
2426
2427 if (m_EM)
2428 {
2429 m_EM.SetEnergy(0);
2430 }
2431 }
2432
2433 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
2434 {
2436
2437 if (m_EM)
2438 {
2439 m_EM.SetEnergy(m_EM.GetEnergyMax());
2440 }
2441 }
2442
2443 else if (action_id == EActions.ADD_HEALTH)
2444 {
2445 AddHealth("","",GetMaxHealth("","Health")/5);
2446 }
2447 else if (action_id == EActions.REMOVE_HEALTH)
2448 {
2449 AddHealth("","",-GetMaxHealth("","Health")/5);
2450 }
2451 else if (action_id == EActions.DESTROY_HEALTH)
2452 {
2453 SetHealth01("","",0);
2454 }
2455 else if (action_id == EActions.WATCH_ITEM)
2456 {
2458 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
2459 #ifdef DEVELOPER
2460 SetDebugDeveloper_item(this);
2461 #endif
2462 }
2463
2464 else if (action_id == EActions.ADD_TEMPERATURE)
2465 {
2466 AddTemperature(20);
2467 //PrintVariables();
2468 }
2469
2470 else if (action_id == EActions.REMOVE_TEMPERATURE)
2471 {
2472 AddTemperature(-20);
2473 //PrintVariables();
2474 }
2475
2476 else if (action_id == EActions.FLIP_FROZEN)
2477 {
2478 SetFrozen(!GetIsFrozen());
2479 //PrintVariables();
2480 }
2481
2482 else if (action_id == EActions.ADD_WETNESS)
2483 {
2484 AddWet(GetWetMax()/5);
2485 //PrintVariables();
2486 }
2487
2488 else if (action_id == EActions.REMOVE_WETNESS)
2489 {
2490 AddWet(-GetWetMax()/5);
2491 //PrintVariables();
2492 }
2493
2494 else if (action_id == EActions.LIQUIDTYPE_UP)
2495 {
2496 int curr_type = GetLiquidType();
2497 SetLiquidType(curr_type * 2);
2498 //AddWet(1);
2499 //PrintVariables();
2500 }
2501
2502 else if (action_id == EActions.LIQUIDTYPE_DOWN)
2503 {
2504 int curr_type2 = GetLiquidType();
2505 SetLiquidType(curr_type2 / 2);
2506 }
2507
2508 else if (action_id == EActions.MAKE_SPECIAL)
2509 {
2510 auto debugParams = DebugSpawnParams.WithPlayer(player);
2511 OnDebugSpawnEx(debugParams);
2512 }
2513
2514 else if (action_id == EActions.DELETE)
2515 {
2516 Delete();
2517 }
2518
2519 }
2520
2521
2522 return false;
2523 }
EActions
Определения EActions.c:2
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
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:3292
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:3885
override int GetQuantityMax()
Определения ItemBase.c:3338
void SetQuantityMax()
Определения ItemBase.c:3297
override int GetLiquidType()
Определения ItemBase.c:3779
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:3238
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:3763
void ItemBase()
Определения ItemBase.c:140
override void RemoveAgent(int agent_id)
Определения ItemBase.c:3866
override float GetWetMax()
Определения ItemBase.c:3611
override void AddWet(float value)
Определения ItemBase.c:3596
proto native CGame GetGame()

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