sumghai Posted January 16, 2016 Share Posted January 16, 2016 While waiting on third-party fixes for SDHI Service Module System, I've decided to dust off another add-on idea I had: Beta-2 download (GitHub) Features: - Five standard industrial warning colors (amber, blue, green, red and white) - Low ElectricCharge consumption (36 EC/hour; values not final) - Toggleable via Action Groups - No plugins required; only uses stock ModuleLight Stuff I need to fix: - Strobe model center of origin and surface attachment behavior needs tweaking - Part search tags are missing Licence: This parts pack is licenced under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0), which in layman's terms means: - You are permitted to use, copy, redistribute my work as-is - You may remix your own derivatives (new models, alternative textures), and release them under your own name - You must credit Robin "sumghai" Chang (author, Sum Dum Heavy Industries Strobe-O-Matic Warning Rotator Light) when publishing your derivatives in the download and forum posts Special thanks to: @taniwha and @RoverDude for helping me get ModuleAnimationGroup and ModuleResourceConverter (mostly) working for the initial prototype, and @nli2work for getting ModuleLight to work with looped animations in the second prototype Link to comment Share on other sites More sharing options...
RoverDude Posted January 16, 2016 Share Posted January 16, 2016 You are very welcome Link to comment Share on other sites More sharing options...
sumghai Posted January 16, 2016 Author Share Posted January 16, 2016 Beta download now available! See OP for details. Any help in shutting off the lights on EC depletion would be greatly appreciated. Link to comment Share on other sites More sharing options...
Kartoffelkuchen Posted January 16, 2016 Share Posted January 16, 2016 Lovely! I have no idea about lights, but maybe just add an Input Resource(ElectricCharge)? No idea if that would work though. Link to comment Share on other sites More sharing options...
sashan Posted January 16, 2016 Share Posted January 16, 2016 1 hour ago, sumghai said: ny help in shutting off the lights on EC depletion would be greatly appreciated. You need to set it up with ModuleLight Link to comment Share on other sites More sharing options...
sumghai Posted January 17, 2016 Author Share Posted January 17, 2016 50 minutes ago, Kartoffelkuchen said: Lovely! I have no idea about lights, but maybe just add an Input Resource(ElectricCharge)? No idea if that would work though. The ModuleResourceConverter already has ElectricCharge set as an InputResource - the lights definitely consume EC when running, but continue to run after depleting it. 15 minutes ago, sashan said: You need to set it up with ModuleLight But how would one integrate that with the looping animation in ModuleAnimationGroup? Link to comment Share on other sites More sharing options...
Anodizer Posted January 17, 2016 Share Posted January 17, 2016 (edited) After watching The Martian for the 5th time in the last month, I have been wanting one of these.. Maybe put in an option to change the speed of the rotation.. Or not.. Either way, love this! Thanks!! \m/(>.<)\m/ Edited January 17, 2016 by Anodizer Link to comment Share on other sites More sharing options...
sumghai Posted January 17, 2016 Author Share Posted January 17, 2016 1 hour ago, Anodizer said: Maybe put in an option to change the speed of the rotation.. AFAIK, ModuleAnimationGroup does not support adjustable animation speeds - besides, the current (fixed) speed is adequate for most applications. Link to comment Share on other sites More sharing options...
sumghai Posted January 18, 2016 Author Share Posted January 18, 2016 So here's an update on my attempts at solving the "strobe not turning off by itself when EC is depleted issue": As some of you may have noticed, if ModuleResourceConverter runs out of inputs, ModuleAnimationGroup's looping animation (defined by activeAnimationName) will continue to play; for example, when the stock ISRU runs out of ElectricCharge or Ore, the converter stops processing resources, but the ISRU's pistons-and-gear animation remains active. According to @RoverDude, this was apparently a deliberate design decision to prevent user frustration, which I suspect to mean that an uncontrollable vessel with an activated ISRU will automatically resume resource conversion as soon as another vessel docks and provides the missing inputs. However, I'm sure most of you will probably find it strange that the animation depicts mechanical parts moving in the absence of energy input. One suggestion was for me to code a custom plugin with a PartModule to either detect when resources are depleted (and then tell ModuleAnimationGroup to stop playing), or to completely handle looped animation with resource consumption from intrinsically/from scratch. My reluctance to pursue this option stems from the following: - Having received (and still continue to receive) complaints that my previous add-ons used "too many dependencies", I thought it would have been nice to do something that relied purely on stock part modules for a change - Regardless of how "few lines of code"/"easy"/"short" it may be, I am unfamiliar with plugin coding; my primary expertise is in modelling/texturing - I know that some of my other projects relied on contributions from plugin coders, but for a simple add-on such as this I'd prefer not to do so Another (cryptic) suggestion as offered by @sashan was to "use ModuleLight". After a quick few experiments, I found that ModuleLight does not support looped animations, even if I go into Unity 4.2.2 and re-export the part with the animation Wrap Mode set to Loop (strangely, ModuleAnimationGroup does recognize animations with baked loops, but that's another story). So my options are thus: - Ask if ModuleAnimationGroup could be modified with an additional parameter to stop the looping animation if all ModuleResourceConverters present run out of resources and become inactive. - Ask if ModuleLight could be modified to intrinsically support looped animations, possibly by detecting what Wrap Mode was baked into a user-specified animation in the model file. - Code (or get someone to code) a bespoke plugin, thereby nullifying one of the selling points of this add-on. What do you guys reckon? Link to comment Share on other sites More sharing options...
sashan Posted January 18, 2016 Share Posted January 18, 2016 6 hours ago, sumghai said: was to "use ModuleLight". After a quick few experiments, I found that ModuleLight does not support looped animations, even if I go into Unity 4.2.2 and re-export the part with the animation Wrap Mode set to Loop (strangely, ModuleAnimationGroup does recognize animations with baked loops, but that's another story). I have another idea, use modulelight to toggle light and separate animation module to toggle rotation. Link to comment Share on other sites More sharing options...
sumghai Posted January 18, 2016 Author Share Posted January 18, 2016 3 hours ago, sashan said: I have another idea, use modulelight to toggle light and separate animation module to toggle rotation. When EC runs out, the light will turn off, but the rotator will keep spinning. I'm not keen on this idea at all. Besides, it's rather unintuitive for a user to have to treat the light and the spinner as two separate toggles, even if bound via the same action group. Link to comment Share on other sites More sharing options...
sashan Posted January 18, 2016 Share Posted January 18, 2016 1 hour ago, sumghai said: When EC runs out, the light will turn off, but the rotator will keep spinning. I'm not keen on this idea at all. Well, it's better than nothing. I dunno, really. Check Baha's animation modules plugin. the one that powers his critter crawler - maybe it has what you need? Link to comment Share on other sites More sharing options...
sumghai Posted January 18, 2016 Author Share Posted January 18, 2016 2 minutes ago, sashan said: Well, it's better than nothing. I dunno, really. Check Baha's animation modules plugin. the one that powers his critter crawler - maybe it has what you need? I previously attempted to use Baha's animation modules, but he informed me that the GenericLoopAnimation PartModule doesn't work properly yet (and nor does it support resource consumption): On 8/08/2014 at 0:12 PM, BahamutoD said: Yeah I haven't fixed generic loop yet. I'll be sure to make the deploy animation optional. Besides, BDAnimationModules has not been updated in over eight months, and I'd like to reiterate once again that for the purposes of this add-on, I'd like to avoid relying on third-party dependencies. Link to comment Share on other sites More sharing options...
RoverDude Posted January 19, 2016 Share Posted January 19, 2016 It's about three lines of code. The architecture of how the resource system works is based on extension (even the stock modules do this). So that you can react to all of the nice output that gets passed along to you. For example, some modules actually *do* shut off in the absence of EC - it's wired in there. But you have a light, not a drill. so probably of very little help to you (well, other than the bit where I left it super open to extension). Link to comment Share on other sites More sharing options...
BFGfreak Posted January 19, 2016 Share Posted January 19, 2016 Can I suggest a part? After watching The Martian I kind of want sort of an extra bright white lighthouse styled part, maybe stack and surface attachable at either size 0 or 1 so that my kerbals could find their way to the lander in severe duststorms at night. Kind of like what you see in this clip in the background https://youtu.be/s0V-kqIe4pw?t=51s Link to comment Share on other sites More sharing options...
sumghai Posted January 19, 2016 Author Share Posted January 19, 2016 2 hours ago, RoverDude said: It's about three lines of code. The architecture of how the resource system works is based on extension (even the stock modules do this). So that you can react to all of the nice output that gets passed along to you. For example, some modules actually *do* shut off in the absence of EC - it's wired in there. But you have a light, not a drill. so probably of very little help to you (well, other than the bit where I left it super open to extension). Including or excluding the usual code declarations / structures / overrides for KSP plugins? I appreciate that you're trying to help, @RoverDude, but plugins generally terrify me. I prefer to just use them and not worry about constantly maintaining them myself to the detriment of my main focus (modelling and texturing). My SDHI SMS mod not-so-recently lost the self-inflating flotation collar feature after the corresponding plugin author stopped maintaining his work, and I'd much rather not subject myself to setting up another mod for failure. I think I'll be better off submitting a feature request for ModuleLight to support strobes/looped animations, which will help other modders too. 1 hour ago, BFGfreak said: Can I suggest a part? After watching The Martian I kind of want sort of an extra bright white lighthouse styled part, maybe stack and surface attachable at either size 0 or 1 so that my kerbals could find their way to the lander in severe duststorms at night. Kind of like what you see in this clip in the background https://youtu.be/s0V-kqIe4pw?t=51s I watched the clip, but it was too dark to discern the actual appearance of the proposed prop. Perhaps if you could get a screenshot from the film with the same prop in good daylight, I may look into this further. Link to comment Share on other sites More sharing options...
ForumUser Posted January 26, 2016 Share Posted January 26, 2016 Does this work with 1.0.4? Link to comment Share on other sites More sharing options...
sumghai Posted January 26, 2016 Author Share Posted January 26, 2016 2 hours ago, ForumUser said: Does this work with 1.0.4? This add-on was developed in 1.0.5, so I can't guarantee it will work on earlier versions of the game. Sorry! Link to comment Share on other sites More sharing options...
V8jester Posted February 9, 2016 Share Posted February 9, 2016 Hey is there a chance you could add a "toggle" button for the AG? Currently (unless I'm totally blind - which is possible) you need a button to turn it on and a button to turn it off again. Otherwise Really great work! These look fantastic in game! Link to comment Share on other sites More sharing options...
sumghai Posted February 9, 2016 Author Share Posted February 9, 2016 4 minutes ago, V8jester said: Hey is there a chance you could add a "toggle" button for the AG? Currently (unless I'm totally blind - which is possible) you need a button to turn it on and a button to turn it off again. Otherwise Really great work! These look fantastic in game! Sorry, no can do. This WIP mod was an attempt at a stock-only implementation of rotating strobe lights, and I couldn't get any combination of ModuleAnimationGroup and ModuleResourceConverter to do what you're requesting. Link to comment Share on other sites More sharing options...
V8jester Posted February 10, 2016 Share Posted February 10, 2016 1 hour ago, sumghai said: Sorry, no can do. This WIP mod was an attempt at a stock-only implementation of rotating strobe lights, and I couldn't get any combination of ModuleAnimationGroup and ModuleResourceConverter to do what you're requesting. Bummer. Well thanks just the same. Link to comment Share on other sites More sharing options...
Azimech Posted February 10, 2016 Share Posted February 10, 2016 (edited) Crazy idea, it will probably work: Configure it using ModuleEngineFX running on ElectricCharge with thrustTransform placed inside the model so it won't thrust in any direction, give a min & max thrust of the same value, use FXModuleAnimateThrottle for the rotation and add ModuleLight. It's just that FXModuleAnimateThrottle has some parameters I'm not sure how to configure yet. My own mod "Sirens!" uses ModuleEngineFX as well, with the fun part that they change pitch according to throttle setting. I also use it for my boilers and steam driven electrical generators in my WW2W mod. ModuleEngineFX is incredibly configurable and a number of modules can be slaved to it. This way it can be toggled too, but you need to set both the engine and light to the same AG toggle. Can't be made easier than this because ModuleLight can't be slaved to ModuleEngineFX. Unless you use a custom resource definition, use ModuleAlternator to create it and ... somehow convince ModuleLight to use this resource instead -> not sure this is possible. And thank you for your work, I will most happily put it on my aircraft. Edited February 10, 2016 by Azimech Link to comment Share on other sites More sharing options...
sumghai Posted February 11, 2016 Author Share Posted February 11, 2016 14 hours ago, Azimech said: Crazy idea, it will probably work: Configure it using ModuleEngineFX running on ElectricCharge with thrustTransform placed inside the model so it won't thrust in any direction, give a min & max thrust of the same value, use FXModuleAnimateThrottle for the rotation and add ModuleLight. It's just that FXModuleAnimateThrottle has some parameters I'm not sure how to configure yet. My own mod "Sirens!" uses ModuleEngineFX as well, with the fun part that they change pitch according to throttle setting. I also use it for my boilers and steam driven electrical generators in my WW2W mod. ModuleEngineFX is incredibly configurable and a number of modules can be slaved to it. This way it can be toggled too, but you need to set both the engine and light to the same AG toggle. Can't be made easier than this because ModuleLight can't be slaved to ModuleEngineFX. Unless you use a custom resource definition, use ModuleAlternator to create it and ... somehow convince ModuleLight to use this resource instead -> not sure this is possible. And thank you for your work, I will most happily put it on my aircraft. This is a rather...intriguing approach. I might look into this after I've released an update to SDHI SMS. Link to comment Share on other sites More sharing options...
Overland Posted February 15, 2016 Share Posted February 15, 2016 Awsome idea really.. but id say they need more brightness, a larger cone of light? in the past ive used the aviation lights for flashers. they typicly light up the top of the cab a bit too much and half of the hood, although its hypnotic on long drives between stations your light more fits the purpose and I love the model, animation etc.. but.. the light is a little weak.. could we have it large enough so it'd reflect off nearby buildings without much performance hit? Link to comment Share on other sites More sharing options...
sumghai Posted February 15, 2016 Author Share Posted February 15, 2016 8 hours ago, Overland said: Awsome idea really.. but id say they need more brightness, a larger cone of light? in the past ive used the aviation lights for flashers. they typicly light up the top of the cab a bit too much and half of the hood, although its hypnotic on long drives between stations your light more fits the purpose and I love the model, animation etc.. but.. the light is a little weak.. could we have it large enough so it'd reflect off nearby buildings without much performance hit? I'll look into tweaking the light intensity and range when I revisit this project in the future. Link to comment Share on other sites More sharing options...
Recommended Posts