Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using ICities;
- using UnityEngine;
- namespace PropRotating
- {
- public class PropRotatingMod : LoadingExtensionBase, IUserMod
- {
- public string Name => "PropRotating Params";
- public string Description => "Loads PropRotating parameters.";
- public override void OnLevelLoaded(LoadMode mode)
- {
- base.OnLevelLoaded(mode);
- ApplyParams();
- }
- public override void OnLevelUnloading()
- {
- base.OnLevelUnloading();
- }
- private void ApplyParams()
- {
- for (uint i = 0; i < PrefabCollection<PropInfo>.LoadedCount(); i++)
- {
- var prefab = PrefabCollection<PropInfo>.GetLoaded(i);
- if (prefab == null) continue;
- if (prefab.m_mesh.name.Contains("PropRotating") == true)
- {
- string[] floats = prefab.m_mesh.name.Split(' ');
- var vec = new Vector4(Convert.ToSingle(floats[1]), Convert.ToSingle(floats[2]), Convert.ToSingle(floats[3]), Convert.ToSingle(floats[4]));
- prefab.m_rollParams[0] = vec;
- var vec2 = new Vector4(Convert.ToSingle(floats[5]), Convert.ToSingle(floats[6]), Convert.ToSingle(floats[7]), 1.0f);
- prefab.m_rollLocation[0] = vec2;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement