[A12] Weapon Effects[v1.2.0]

Started by SlimeCrusher, November 14, 2015, 03:47:55 PM

Previous topic - Next topic

SlimeCrusher

Weapon Effects
Formerly known as "Rocket Effects"
v1.2.0
General:
<----------------------------------------------------------------------------------------------------------->
Tired of those old spring-launched rockets with no residue smoke? Need a way to make firearms look nicer when shot? Don't know where that mortar shell came from? Don't worry, Weapon Effects will fix all that.
Adds new awesome effects to most weapons, like smoke trails for rockets and mortars, case-dropping firearms and sparking charge projectiles.

Doesn't modify any stats
Full Preview:
<----------------------------------------------------------------------------------------------------------->
-Doomsday rocket launcher:

-Triple rocket launcher:

Spent cartridge drops:

-[NEW!] Molotov Cocktails:

-[NEW!] Charge projectiles:

-[NEW!] Mortar trails:

Download:
<----------------------------------------------------------------------------------------------------------->
To install:
<----------------------------------------------------------------------------------------------------------->
.Simply download the mod, unzip it and drag it to your Rimworld/Mods folder. Make sure the folder setup is "Rimworld/Mods/Weapon Effects/Defs,Sounds,etc" and not "Mods/Weapon Effects/Weapon Effects".
.Then, boot up Rimworld and activate the mod via "Mods" menu.
.You don't need to make a new colony to use this mod.

THIS MOD IS INCOMPATIBLE WITH: Mods that modify pretty much any projectile code. They will load and work, but you'll get a console error (probably) and you won't see any cool effects
Changelog:
<----------------------------------------------------------------------------------------------------------->
v1.0: Initial Release.

v1.1: Added new casing drop effects on firearms
Changed name from "Rocket Effects" to "Weapon Effects".

v1.2.0: Added another digit to update number
Casings now despawn slower
Casings are now spawned at pawn's location (instead of 1 tick after firing)
Added new effects for charge projectiles
Added new effects for mortar shells
Added a new "secondary" sound effect to mortar shells wich plays JUST before impact
Added new "firetrail" effect for molotov cocktails
"Optimized" a bit of code (aka removed 1 class)

You just found the last message i'm making on the forums, hooray! You win a cookie. Bye fellow stranger. Don't worry, i'll come back when tynan does, i've gotten sick of modding. And no, i'm not going to update this again, too hard to code C# alone.
To do/Plans for future:
<----------------------------------------------------------------------------------------------------------->
-Add some kind of effect for charge weapons.  Done! (v1.2.0)
-Make this somewhat usable via XML for easier making of new effects. (for compatibility patches mainly)

-Make compatibility patches!
-Add a trail to mortars that spawns even when you aren't looking Done! (v1.2.0)

If you want to suggest a feature, do it, i need as many ideas as i can!  ;D
Licence and Credits:
<----------------------------------------------------------------------------------------------------------->

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

The mod "Turret Collection" by eatKenny was used as an inspiration for this mod, i used a bit of code from it as a base for developing the rocket effects(modified a lot of it), wich then evolved into casing drops (wich i made my own code!). Thanks to him ;D
Rocket sounds are heavily edited Battlefield 1942 rocket sounds (i like old games).

LustrousWolf

Damn this sounds neat!!! Any chance of doing this to the missiles fired from the mortars?? :o

SlimeCrusher

Quote from: LustrousWolf on November 14, 2015, 03:51:39 PM
Damn this sounds neat!!! Any chance of doing this to the missiles fired from the mortars?? :o
Uh i think mortars fire shells and not missiles :P
Maybe i can think of another trail effect, or just a very faint smoke trail for mortar shells

Elixiar

Being able to see streaks in the sky from mortar exchanges would be super cool. Would be nice if the lingered a little too.
"We didn't crash here by accident... something brought us down". - Anon Rimworld Colonist

SlimeCrusher

#4
The main problem is that there seems to be a limit on how many motes ("sprites" for non-modders) can be spawned in. So if i make a long-lasting mortar trail, it's just going to work for a single shell, since if 2 shells are fired within the time the trail is visible, the trail will sort of cut-off mid-way the target. I don't know if it's really going to be such a large problem or not, i'll see what i can come up with.

I just quickly implemented the rocket code to mortars and realised the problem is the same, but in a different way.
Motes are only generated if the camera is watching the generator object (the mortar shell), so if an enemy fires a mortar shell while you aren't looking, and then suddenly it appears, the smoke trail will end up looking cut in half.
No idea if this is solvable or not.

SlimeCrusher

Updated!
Added new casing drop effects for firearms (i'll add a preview soon i promise). I've changed the name of the mod in order to account for new effects (since they have nothing to do with rockets)
No new mortar effects yet, i wasted a bit of time researching on XML conversion but didn't work out and i ended up breaking the rockets. So i'll retry that later. Maybe next update i'll work on mortars.

Mechanoid Hivemind

Quote from: SlimeCrusher on November 20, 2015, 11:37:59 AM
Updated!
Added new casing drop effects for firearms (i'll add a preview soon i promise). I've changed the name of the mod in order to account for new effects (since they have nothing to do with rockets)
No new mortar effects yet, i wasted a bit of time researching on XML conversion but didn't work out and i ended up breaking the rockets. So i'll retry that later. Maybe next update i'll work on mortars.
If i may but in, i would like the whistle that the mortar gives as it falls, ya know that last sound before you see your as* fly infront of you
The individual is obsolete. When you and your kind are extinct, we will cleanse our collective memory of the stain of your existence.

sanya02

you can do a long the disappearance of bullet casings from bullets ?

LustrousWolf

Nice weapon effects! Does this work with combat realism mod? :O

SlimeCrusher

Quote from: Mechanoid Hivemind on November 21, 2015, 12:45:33 AM
If i may but in, i would like the whistle that the mortar gives as it falls, ya know that last sound before you see your as* fly infront of you
So you say that i should add a "bomb" whistle as mortar shells are about to fall? It should be easy enough, i'll see what i can do ;)
Quote from: sanya02 on November 21, 2015, 01:51:37 AM
you can do a long the disappearance of bullet casings from bullets ?
Yea i can make them last a bit longer, i didn't make them too long-lasting because i was scared i'd lag the game or something. I'll increase their lifespan next update.
Quote from: LustrousWolf on November 21, 2015, 05:02:31 AM
Nice weapon effects! Does this work with combat realism mod? :O
Not ATM, but i plan to make it compatible soon. Maybe next update. Look foward to it!

NoImageAvailable

I haven't looked at your modifications to the projectile code, but if you're worried about compatibility you might look into making the effects comps. Then you could use the comp injector from CCL and have no hard incompatibilities anymore. The only mods requiring patches would be those with new weapons and even those would be easier to make and maintain.
"The power of friendship destroyed the jellyfish."

Alistaire

Shell casings shouldn't eject from either the stock of a machine gun or the barrel of an assault rifle~~-

SlimeCrusher

Quote from: Alistaire on November 21, 2015, 11:20:26 AM
Shell casings shouldn't eject from either the stock of a machine gun or the barrel of an assault rifle~~-
Errm i know?
Oh wait, i just realised that i could make the casing spawn when fired instead 1 tick after... I really don't know why i did it the way i made it. Oh well expect pretty much everything fixed next update (yes i know i'm promising a lot of stuff for v1.2), but they'll still eject from the stock.

Alistaire

You can make a single C# solution and add a new project under that solution, that way you can compile both projects under the same solution
and under the same DLL.

CCL can inject tags into existing ThingDefs so you don't have to overwrite bullets as you're currently doing. A method to spawn in shells in the
correct position could be to add the functionality on the weapons' ThingDef (instead of the projectile's ThingDef) and add a Comp (look at CR,
can also be injected with CCL) which includes some parameter for the distance from pawn center to the ejection port.

The problem with spawning in motes on the projectiles themselves is that CR for example modifies bullet speeds so the casings would drop
quite some ways away from the gun on assault rifles for example.

SlimeCrusher

Thanks Alistaire!
Currently (dev version) the bullets spawn using SpawnSetup instead of ticks like it used to. So CR shouldn't have a problem with high-speed bullets. I've already made the dll into a single solution, too. I'll look into CCL later, and i'll see if i can make it more tweakable using comps instead of full-on C#.