aliens

Author Topic: [CODE SUBMISSION] Grenade chaining  (Read 10184 times)

Offline Tesseract

  • Squaddie
  • *
  • Posts: 3
    • View Profile
[CODE SUBMISSION] Grenade chaining
« on: June 23, 2015, 03:15:27 pm »
Hi folks,
discovering OXC recently, I'm having a blast playing skirmishes all day long! So I wanted to thank our fine coding crew and mod developers for outstanding job plus special cheers to Meridian and Ivan Dogovich for their entertaining LPs.  :)

Anyway, to the point. I was unhappy with the way how explosions destroy things around, in particular situations where Mr. Chrysalid rushes my early tech squad and I can't throw at him more than one grenade in one turn. I know there are solutions - use instant gredanes or the TFTD way, making them undestroyable - but both have drawbacks and TFTD way needs mod tweaking.
My proposed way to deal with this is having primed explosives explode in situations where they would vanish otherwise. As the source is well structured, I took a crack at coding it myself. As far as I can tell, it seems to work fine, but I'd still recommend review from someone more familiar with the source (main change is about 4 lines of code long, new related advanced option added). In particular, position of explosion currently doesn't use any offsets, I'm not sure if at least proxy grenades shouldn't explode little higher.

Hope you guys find it useful, I'm off to create some large scale proxy + heavy explosive minefield. :D
PS. sorry if placed in wrong subforum!

Offline Yankes

  • Commander
  • *****
  • Posts: 3309
    • View Profile
Re: [CODE SUBMISSION] Grenade chaining
« Reply #1 on: June 23, 2015, 03:22:46 pm »
In my extended version all grenades explode at "once". That mean one explosion can't stop another one form same turn.
Overall that type of changes should go to mod forum. Because it change how basic game work.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11694
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [CODE SUBMISSION] Grenade chaining
« Reply #2 on: June 23, 2015, 03:31:54 pm »
Oh noez! It's X-Com: Apocalypse all over again! D:


;)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: [CODE SUBMISSION] Grenade chaining
« Reply #3 on: June 23, 2015, 03:48:59 pm »
...plus special cheers to Meridian and Ivan Dogovich for their entertaining LPs.  :)

Yaaay, we're famous! ;-)
But only until Friday... when we become infamous... #ThreeDaysLeft

Offline Tesseract

  • Squaddie
  • *
  • Posts: 3
    • View Profile
Re: [CODE SUBMISSION] Grenade chaining
« Reply #4 on: June 23, 2015, 04:13:24 pm »
I hadn't checked Extended until now, fine solution there. Yet still, my hunger for remote proxy detonation and chained explosions consistent with Elerium sources blowing up wouldn't be satisfied by that. :P

Also apologies again, not only I misplaced this thread but only now I spotted the "How to contribute code" thread!  :-[ I guess I was too enthusiastic, but I posted diffs, so it's hopefully not a big deal.

Hmm, but if Yankes is right and this change should be considered mod - not a tweak like instant grenades - I'm worried if WarBoy/SupSuper will be interested in this regardless if it's good or not.
Yankes, would you consider adding it to Extended if that would be the case? I can still see some uses for this.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11694
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [CODE SUBMISSION] Grenade chaining
« Reply #5 on: June 23, 2015, 04:22:08 pm »
For now I've requested this thread to be moved to the appropriate subforum, so it'll be moved if necessary.

BTW Meridian, sorry but why exactly are you going to be infamous...? :)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: [CODE SUBMISSION] Grenade chaining
« Reply #6 on: June 23, 2015, 04:28:09 pm »
BTW Meridian, sorry but why exactly are you going to be infamous...? :)

Just teasing you :)
Friday's episode will be... unlike others.

Offline Yankes

  • Commander
  • *****
  • Posts: 3309
    • View Profile
Re: [CODE SUBMISSION] Grenade chaining
« Reply #7 on: June 23, 2015, 04:46:09 pm »
I hadn't checked Extended until now, fine solution there. Yet still, my hunger for remote proxy detonation and chained explosions consistent with Elerium sources blowing up wouldn't be satisfied by that. :P

Also apologies again, not only I misplaced this thread but only now I spotted the "How to contribute code" thread!  :-[ I guess I was too enthusiastic, but I posted diffs, so it's hopefully not a big deal.

Hmm, but if Yankes is right and this change should be considered mod - not a tweak like instant grenades - I'm worried if WarBoy/SupSuper will be interested in this regardless if it's good or not.
Yankes, would you consider adding it to Extended if that would be the case? I can still see some uses for this.
After looking at your diffs I see you did it in proper way (as toggled option), this will increase chance of accepting it by WarBoy/SupSuper.

As for my version. In current state I will not accept it, but as overall idea I could be added. Primary thing that need be change is remove global option and give it per item basic e.g. RuleItem class will have new field that will control this behavior. This should work for any item not only grenades (ammo should explode too).

And for proper way of contribution to source we use https://github.com/SupSuper/OpenXcom/pulls

Offline Bloax

  • Colonel
  • ****
  • Posts: 322
  • do you want to be any of those things
    • View Profile
Re: [CODE SUBMISSION] Grenade chaining
« Reply #8 on: June 23, 2015, 06:07:58 pm »
Just teasing you :)
Friday's episode will be... unlike others.

Even worse than a super secret mission Meridian™ cliffhanger?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11694
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [CODE SUBMISSION] Grenade chaining
« Reply #9 on: June 23, 2015, 06:23:32 pm »
As for my version. In current state I will not accept it, but as overall idea I could be added. Primary thing that need be change is remove global option and give it per item basic e.g. RuleItem class will have new field that will control this behavior. This should work for any item not only grenades (ammo should explode too).

But that'd require adding yet another line to the item, namely power. How powerfully does a rifle clip explode? Or a medikit (because someone crazy enough will want exploding medikits)?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: [CODE SUBMISSION] Grenade chaining
« Reply #10 on: June 23, 2015, 06:29:21 pm »
Even worse than a super secret mission Meridian™ cliffhanger?

My mouth is shut. I haven't said anything; I was not here. You can torture me all you want, I won't reveal XCOM classified information.

Lol, so many references ;-) I'm laughing at my own jokes... that's not healthy... I'll stop now. Post or cancel? <clicks on Post> Dang it... now everyone knows I'm slowly going crazy.

Edit: sorry Tesseract for this terrible thread jack... this was my last post, I promise  ::)

Offline Yankes

  • Commander
  • *****
  • Posts: 3309
    • View Profile
Re: [CODE SUBMISSION] Grenade chaining
« Reply #11 on: June 23, 2015, 08:01:50 pm »
But that'd require adding yet another line to the item, namely power. How powerfully does a rifle clip explode? Or a medikit (because someone crazy enough will want exploding medikits)?
After looking on code I see only one simple way of adding this. One field with true/false and work only with explosive weapons/items. This mean It could work for medikit (because it don't use power/radius) but not for laser rifles (because "explosion" will be laser hit at ground).

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11694
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [CODE SUBMISSION] Grenade chaining
« Reply #12 on: June 23, 2015, 08:09:31 pm »
After looking on code I see only one simple way of adding this. One field with true/false and work only with explosive weapons/items. This mean It could work for medikit (because it don't use power/radius) but not for laser rifles (because "explosion" will be laser hit at ground).

I don't understand; how much damage would a Medikit do? It doesn't have any damage values.

Offline Yankes

  • Commander
  • *****
  • Posts: 3309
    • View Profile
Re: [CODE SUBMISSION] Grenade chaining
« Reply #13 on: June 24, 2015, 12:12:08 am »
Item definition have. Its not used but game still have it. Every item in game is exactly same, only battle type change what is used.
When you add "power" to medikit it will be loaded from ruleset but will not be used. When I would add new behavior I can exploit it by treating medikit item as grenade when I try explode it. This is very similar to how corpse explosion work. You add to corpse item power and radius. After that in correct circumstances you can create explosion after unit die.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5455
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: [CODE SUBMISSION] Grenade chaining
« Reply #14 on: June 24, 2015, 03:14:19 pm »
On that note - would you consider enabling Ammo use for all items in Extended? The primary objective would be perishable medikits, which make much more sense than eternal ones. For the Medkits, I'm seeing as every use (stim, heal, painkiller) would reduce ammo by 1. For psi-type items, every usage. Naturally ammo clips should be an option too.