162 ? ComponentGui.ShortInventoryWidget.MaxVisibleSlotsCountInCreative
163 :
ComponentGui.ShortInventoryWidget.MaxVisibleSlotsCount;
165 ? (ComponentMiner.Inventory.ActiveSlotIndex + playerInput.ScrollInventory + max) % max
166 : ComponentMiner.Inventory.ActiveSlotIndex + playerInput.
ScrollInventory;
168 ComponentMiner.Inventory.ActiveSlotIndex = Math.Clamp(playerInput.
SelectInventorySlot.Value, 0, max - 1);
175 if (componentSteedBehavior !=
null) {
176 bool skipVanilla_h =
false;
178 "OnPlayerControlSteed",
180 loader.OnPlayerControlSteed(
this, skipVanilla_h, out
bool skipVanilla);
181 skipVanilla_h |= skipVanilla;
185 if (!skipVanilla_h) {
186 if (playerInput.
Move.
Z > 0.5f
189 PlayerData.PlayerClass ==
PlayerClass.Male ?
"Audio/Creatures/MaleYellFast" :
"Audio/Creatures/FemaleYellFast",
196 componentSteedBehavior.SpeedOrder = 1;
199 else if (playerInput.
Move.
Z < -0.5f
202 PlayerData.PlayerClass ==
PlayerClass.Male ?
"Audio/Creatures/MaleYellSlow" :
"Audio/Creatures/FemaleYellSlow",
209 componentSteedBehavior.SpeedOrder = -1;
212 else if (MathF.Abs(playerInput.
Move.
Z) <= 0.25f) {
215 componentSteedBehavior.TurnOrder = playerInput.
Move.
X;
216 componentSteedBehavior.JumpOrder = playerInput.Jump ? 1 : 0;
220 else if (componentBoat !=
null) {
221 bool skipVanilla_h =
false;
223 "OnPlayerControlBoat",
225 loader.OnPlayerControlBoat(
this, skipVanilla_h, out
bool skipVanilla);
226 skipVanilla_h |= skipVanilla;
230 if (!skipVanilla_h) {
231 componentBoat.TurnOrder = playerInput.
Move.
X;
232 componentBoat.MoveOrder = playerInput.
Move.
Z;
239 bool skipVanilla_h =
false;
241 "OnPlayerControlOtherMount",
243 loader.OnPlayerControlOtherMount(
this, skipVanilla_h, out
bool skipVanilla);
244 skipVanilla_h |= skipVanilla;
251 bool skipVanilla_h =
false;
253 "OnPlayerControlWalk",
255 loader.OnPlayerControlWalk(
this, skipVanilla_h, out
bool skipVanilla);
256 skipVanilla_h |= skipVanilla;
260 if (!skipVanilla_h) {
277 if (playerInput.
Interact.HasValue) {
278 double timeIntervalLastActionTime = 0.33;
288 int priorityPlace = 0;
289 int priorityInteract = 0;
290 if (movingBlocksRaycastResult.HasValue) {
291 int raycastValue = movingBlocksRaycastResult.Value.MovingBlock?.Value ?? 0;
292 if (raycastValue != 0) {
297 else if (terrainRaycastResult.HasValue) {
298 int raycastValue = terrainRaycastResult.
Value.Value;
303 "OnPlayerInputInteract",
306 loader.OnPlayerInputInteract(
309 ref timeIntervalLastActionTime,
311 ref priorityInteract,
326 terrainRaycastResult,
327 movingBlocksRaycastResult,
333 float timeIntervalAim = m_subsystemGameInfo.WorldSettings.GameMode ==
GameMode.Creative ? 0.1f : 1.4f;
334 if (playerInput.
Aim.HasValue) {
335 bool skipVanilla_h =
false;
337 "UpdatePlayerInputAim",
339 loader.UpdatePlayerInputAim(
this,
true, ref flag, ref timeIntervalAim, skipVanilla_h, out
bool skip);
340 skipVanilla_h |= skip;
348 Ray3 value = playerInput.
Aim.Value;
351 if (vector.
X >= size.
X * 0.02f
352 && vector.
X < size.
X * 0.98f
353 && vector.
Y >= size.
Y * 0.02f
354 && vector.
Y < size.
Y * 0.98f) {
370 && !ComponentBody.IsCrouching) {
371 m_aimHintIssued = true;
372 ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 1), Color.White, true, true);
378 else if (
m_aim.HasValue) {
389 bool skipVanilla_h =
false;
391 "UpdatePlayerInputAim",
393 loader.UpdatePlayerInputAim(
this,
false, ref flag, ref timeIntervalAim, skipVanilla_h, out
bool skip);
394 skipVanilla_h |= skip;
406 flag |=
m_aim.HasValue;
407 if (playerInput.Hit.HasValue) {
408 bool skipVanilla_ =
false;
409 double timeIntervalHit = 0.33;
410 float meleeAttackRange = 2f;
411 ModsManager.HookAction(
414 loader.OnPlayerInputHit(
this, ref flag, ref timeIntervalHit, ref meleeAttackRange, skipVanilla_, out
bool skip);
415 skipVanilla_ |= skip;
422 && block.GetMeleeHitProbability(
ComponentMiner.ActiveBlockValue) > 0
423 && meleeAttackRange > 0) {
424 BodyRaycastResult? bodyRaycastResult =
ComponentMiner.Raycast<BodyRaycastResult>(
425 playerInput.Hit.Value,
427 reach: meleeAttackRange
429 if (bodyRaycastResult.HasValue) {
434 bodyRaycastResult.Value.ComponentBody,
435 bodyRaycastResult.Value.HitPoint(),
436 playerInput.Hit.Value.Direction
442 double timeIntervalDig = 0.33;
444 timeIntervalDig = SettingsManager.CreativeDigTime;
446 if (playerInput.Dig.HasValue) {
447 bool skipVanilla_ =
false;
448 ModsManager.HookAction(
449 "UpdatePlayerInputDig",
451 loader.UpdatePlayerInputDig(
this,
true, ref flag, ref timeIntervalDig, skipVanilla_, out
bool skip);
452 skipVanilla_ |= skip;
460 TerrainRaycastResult? terrainRaycastResult2 =
ComponentMiner.Raycast<TerrainRaycastResult>(
461 playerInput.Dig.Value,
464 if (terrainRaycastResult2.HasValue
471 if (!playerInput.Dig.HasValue) {
473 bool skipVanilla_ =
false;
474 ModsManager.HookAction(
475 "UpdatePlayerInputDig",
477 loader.UpdatePlayerInputDig(
this,
false, ref flag, ref timeIntervalDig, skipVanilla_, out
bool skip);
478 skipVanilla_ |= skip;
485 bool skipVanilla_ =
false;
486 ModsManager.HookAction(
487 "UpdatePlayerInputDrop",
489 loader.OnPlayerInputDrop(
this, skipVanilla_, out
bool skip);
490 skipVanilla_ |= skip;
496 int slotValue = inventory.GetSlotValue(inventory.ActiveSlotIndex);
497 int num3 = inventory.RemoveSlotItems(
498 count: inventory.GetSlotCount(inventory.ActiveSlotIndex),
499 slotIndex: inventory.ActiveSlotIndex
503 Vector3 position = ComponentBody.Position
511 if (!playerInput.PickBlockType.HasValue || flag) {
514 if (
ComponentMiner.Inventory is not ComponentCreativeInventory componentCreativeInventory) {
517 TerrainRaycastResult? terrainRaycastResult3 =
ComponentMiner.Raycast<TerrainRaycastResult>(
518 playerInput.PickBlockType.Value,
524 if (!terrainRaycastResult3.HasValue) {
527 int value3 = terrainRaycastResult3.Value.Value;
528 value3 =
Terrain.ReplaceLight(value3, 0);
529 int num4 =
Terrain.ExtractContents(value3);
530 Block block2 = BlocksManager.Blocks[num4];
532 IEnumerable<int> creativeValues = block2.GetCreativeValues();
533 if (block2.GetCreativeValues().Contains(value3)) {
537 && !block2.IsNonDuplicable_(value3)) {
538 List<BlockDropValue> list =
new();
541 && list[0].Count > 0) {
542 num5 = list[0].Value;
546 num5 = creativeValues.FirstOrDefault();
552 for (
int i = 0; i < 10; i++) {
553 if (componentCreativeInventory.GetSlotCapacity(i, num5) > 0
554 && componentCreativeInventory.GetSlotCount(i) > 0
555 && componentCreativeInventory.GetSlotValue(i) == num5) {
561 for (
int j = 0; j < 10; j++) {
562 if (componentCreativeInventory.GetSlotCapacity(j, num5) > 0
563 && (componentCreativeInventory.GetSlotCount(j) == 0 || componentCreativeInventory.GetSlotValue(j) == 0)) {
570 num6 = componentCreativeInventory.ActiveSlotIndex;
572 componentCreativeInventory.RemoveSlotItems(num6,
int.MaxValue);
573 componentCreativeInventory.AddSlotItems(num6, num5, 1);
574 componentCreativeInventory.ActiveSlotIndex = num6;