Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ReplaceVehiclePartToToolsCrate(LootContainer container)
- {
- if (container == null || container.IsDestroyed) return;
- if (!container.ShortPrefabName.Contains("vehicle_parts")) return;
- BaseEntity containerParent = container.GetParentEntity();
- Vector3 spawnPosition = container.transform.position;
- Quaternion spawnRotation = container.transform.rotation;
- container.Kill();
- // SOURCE : https://looty.cc/database?type=crates
- string targetPrefab = "assets/bundled/prefabs/radtown/crate_tools.prefab";
- var crateToolEntity = GameManager.server.CreateEntity(targetPrefab, spawnPosition, spawnRotation);
- if (crateToolEntity == null) return;
- if (containerParent != null)
- {
- crateToolEntity.SetParent(containerParent);
- -------------------------------------------------------------------
- // add the parent
- crateToolEntity.parentEntity = containerEntity;
- ------------------------------------------------------------------
- }
- crateToolEntity.Spawn();
- }
Advertisement
Add Comment
Please, Sign In to add comment