void OnEntitySpawned(HackableLockedCrate crate) { if (!configData.Alerts.HackableCrate) { return; } if (crate == null) { return; } var pos = crate.transform.position; NextTick(() => { string msg = Lang("HackableCrate", null, GetLocation(pos, null, crate)); Server.Broadcast(msg); if (configData.Misc.LogToConsole) { Puts(msg); } if (configData.Misc.LogToFile) { LogToFile("log", $"[{DateTime.Now.ToString("HH:mm:ss")}] {msg}", this); } }); }
private void SpawnCrate() { _marker = GameManager.server.CreateEntity(MARKER_PREFAB, _position) as MapMarkerGenericRadius; if (_marker == null) { return; } _marker.enableSaving = false; _marker.color1 = GetColor(_settings.MarkerColor); _marker.color2 = GetColor(_settings.MarkerBorderColor); _marker.alpha = _settings.MarkerOpacity; _marker.radius = 0.5f; _marker.Spawn(); _crate = GameManager.server.CreateEntity(CRATE_PREFAB, _position, Quaternion.identity) as HackableLockedCrate; if (_crate == null) { return; } _crate.enableSaving = false; _crate.shouldDecay = false; _crate.SetWasDropped(); _crate.Spawn(); _crate.gameObject.GetOrAddComponent <DropComponent>(); _marker.SetParent(_crate); _marker.transform.localPosition = Vector3.zero; _marker.SendUpdate(); }
void OnEntitySpawned(HackableLockedCrate crate) { if (!configData.alerts.hackableCrate) { return; } NextTick(() => { if (crate == null) { return; } var pos = crate.transform.position; if (configData.misc.hideCargoCrates && AtCargoShip(null, crate)) { return; } if (configData.misc.hideRigCrates && (AtLargeRig(pos) || AtSmallRig(pos))) { return; } SendMsg(Lang("HackableCrate", null, GetLocation(pos, null, crate))); }); }
object CanHackCrate(BasePlayer player, HackableLockedCrate crate) { if (!requireInHand) { var has = player.inventory.GetAmount(targetingComputerID); if (has >= numberRequired) { if (consumeLaptop) { player.inventory.Take(null, targetingComputerID, numberRequired); return(null); } } else { message(player, "YouNeed", numberRequired.ToString(), has.ToString()); return(true); } } else { var activeItem = player.GetActiveItem()?.info?.shortname; if (activeItem == null || activeItem == "") { message(player, "NotHolding"); return(true); } if (activeItem == "targeting.computer") { var has = player.inventory.GetAmount(targetingComputerID); if (has >= numberRequired) { if (consumeLaptop) { player.inventory.Take(null, targetingComputerID, numberRequired); } } else { message(player, "YouNeed", numberRequired.ToString(), has.ToString()); return(true); } } else { message(player, "NotHolding"); return(true); } } if (ownCrate) { crate.OwnerID = player.userID; } return(null); }
// return string to tagging this entity private string OnLockedCrateSpawned(string name, HackableLockedCrate entity) { if (IsOnOilRig(entity)) { PrintWarning($"Oil box spawned: {entity.ServerPosition}"); return(OilBoxTag); } PrintWarning($"Hackable box spawned: {entity.ServerPosition}"); return(null); }
private object CanHackCrate(BasePlayer player, HackableLockedCrate crate) { if (player == null) { return(null); } var pos = showCoordinates ? $"{crate.transform.position.x}, {crate.transform.position.y}, {crate.transform.position.z}" : string.Empty; if (HackablePlayersAlert) { Broadcast(Lang("HackablePlayer", player.UserIDString, player.displayName, Position(pos))); } return(null); }
private object CanHackCrate(BasePlayer player, HackableLockedCrate crate) { if (player == null) { return(null); } if (playerPrefs.ContainsKey(player.UserIDString) && !playerPrefs[player.UserIDString]) { return(null); } var prefab = crate.ShortPrefabName; if (prefab == null) { return(null); } foreach (var type in lockableTypes) { if (!prefab.Contains(type)) { continue; } if (!permission.UserHasPermission(player.UserIDString, $"masterkey.{type}")) { return(null); } if (showMessages) { player.ChatMessage(Lang("UnlockedWith", player.UserIDString, type)); } if (logUsage) { Log(Lang("LogUnlock", null, PlayerName(player), type, player.transform.position)); } crate.SetFlag(BaseEntity.Flags.Reserved2, true, false); crate.isLootable = true; return(false); } return(null); }
object CanLootEntity(BasePlayer player, HackableLockedCrate crate) { Puts(player.userID.ToString() + " : " + crate.OwnerID.ToString()); if (ownCrate) { if (player.userID == crate.OwnerID) { return(null); } else { message(player, "YouDontOwn"); return(false); } } return(null); }
void CanHackCrate(BasePlayer player, HackableLockedCrate crate) { if (!configData.Alerts.HackingCrate) { return; } if (player == null || crate == null) { return; } var pos = crate.transform.position; string msg = Lang("HackingCrate", player.UserIDString, player.displayName, GetLocation(pos, null, crate)); Server.Broadcast(msg); if (configData.Misc.LogToConsole) { Puts(msg); } if (configData.Misc.LogToFile) { LogToFile("log", $"[{DateTime.Now.ToString("HH:mm:ss")}] {msg}", this); } }
void CanHackCrate(BasePlayer player, HackableLockedCrate crate) { if (!configData.alerts.hackingCrate) { return; } if (player == null || crate == null) { return; } var pos = crate.transform.position; if (configData.misc.hideCargoCrates && AtCargoShip(null, crate)) { return; } if (configData.misc.hideRigCrates && (AtLargeRig(pos) || AtSmallRig(pos))) { return; } SendMsg(Lang("HackingCrate", player.UserIDString, player.displayName, GetLocation(pos, null, crate))); }
public void BeginEvent(HackableLockedCrate crate) { Instance.Puts($"Beginning locked crate event, crate at @ {crate.transform.position}"); LockedCrates.Add(crate); }
void OnCrateHack(HackableLockedCrate crate) { Puts("OnCrateHack works!"); Broadcast("Die CH47-Ladung wird gehackt"); crate.hackSeconds = 60f; // seconds since hack (initial??) }
private object CanHackCrate(BasePlayer player, HackableLockedCrate crate) => IsLimited(player) ? false : (object)null;
private object CanHackCrate(BasePlayer player, HackableLockedCrate crate) { var @event = new RustPlayerHackingCrateEvent(new RustPlayer(player), crate); return(EmitCancellableReturnsObject(@event)); }
// + Airdrop-Abwurf! void OnCrateDropped(HackableLockedCrate crate) { Puts("OnCrateDropped works!"); Puts("Der CH47-Helicopter hat seine verschlossene Ladung abgeworfen"); }
private void OnEntitySpawned(HackableLockedCrate entity) { HandleEntity(entity); }
public RustPlayerHackingCrateEvent( RustPlayer player, HackableLockedCrate crate) : base(player) { Crate = crate; }