Eonirr

Untitled

Feb 10th, 2026
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. void ReplaceVehiclePartToToolsCrate(LootContainer container)
  2. {
  3. if (container == null || container.IsDestroyed) return;
  4. if (!container.ShortPrefabName.Contains("vehicle_parts")) return;
  5.  
  6. BaseEntity containerParent = container.GetParentEntity();
  7. Vector3 spawnPosition = container.transform.position;
  8. Quaternion spawnRotation = container.transform.rotation;
  9.  
  10. container.Kill();
  11.  
  12. // SOURCE : https://looty.cc/database?type=crates
  13. string targetPrefab = "assets/bundled/prefabs/radtown/crate_tools.prefab";
  14. var crateToolEntity = GameManager.server.CreateEntity(targetPrefab, spawnPosition, spawnRotation);
  15. if (crateToolEntity == null) return;
  16.  
  17. if (containerParent != null)
  18. {
  19. crateToolEntity.SetParent(containerParent);
  20. -------------------------------------------------------------------
  21. // add the parent
  22. crateToolEntity.parentEntity = containerEntity;
  23. ------------------------------------------------------------------
  24. }
  25.  
  26. crateToolEntity.Spawn();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment