internal static bool Prefix(UseableBarricade __instance, uint simulation, bool inputSteady) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(__instance.player); if (player.HasPermission("realestate.bypass")) { return(true); } if (GetValue <bool>(__instance, "isUsing", BindingFlags.NonPublic | BindingFlags.Instance)) { if (GetValue <InteractableVehicle>(__instance, "parentVehicle", BindingFlags.NonPublic | BindingFlags.Instance) != null && RealEstate.instance.Configuration.Instance.enableBuildingOnVehicles) { return(true); } House house = RealEstate.manager.HouseFromPosition(GetValue <Vector3>(__instance, "point", BindingFlags.NonPublic | BindingFlags.Instance)); if (house == null && RealEstate.instance.Configuration.Instance.disableBuildingIfNotInHome) { __instance.player.equipment.dequip(); UnturnedChat.Say(player, RealEstate.instance.Translate("cant_build_outside"), Color.red); return(false); } if (!HouseManager.HouseCheck(house, player)) { __instance.player.equipment.dequip(); UnturnedChat.Say(player, RealEstate.instance.Translate("cant_place_barricades"), Color.red); return(false); } } return(true); }
internal static bool Prefix(UseableStructure __instance, uint simulation, bool inputSteady, bool ___isUsing, Vector3 ___point) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(__instance.player); if (player.HasPermission("realestate.bypass")) { return(true); } if (!___isUsing) { return(true); } House house = RealEstate.manager.HouseFromPosition(___point); if (house == null && RealEstate.instance.Configuration.Instance.disableBuildingIfNotInHome) { __instance.player.equipment.dequip(); RealEstate.instance.TellPlayer(player, RealEstate.instance.Translate("cant_build_outside"), Color.red); return(false); } if (HouseManager.HouseCheck(house, player)) { return(true); } __instance.player.equipment.dequip(); RealEstate.instance.TellPlayer(player, RealEstate.instance.Translate("cant_place_structures"), Color.red); return(false); }