ID:261761
 
Alrighty, this is bothering me. It's not taking away from the buildings hp.
            for(var/turf/damageable/T as turf in X)
T.hp -= round(O.damage)
if(T.hp < 1)
del(T)
del(O)
break
else
Del(O)
break

There isn't any problem in compiling or during runtime for that matter. It's just that after the bullet which is being shot hits the turf, nothing happens except the bullet is deleted. Note that I do have X defined somewhere above that in the full coding.

I'll show these vars I have defined so there is not any confusion in that area.
obj/damageable
var
hp
maxhp
armor

Thanks,
Resonating Light
for(var/turf/damageable/T as turf in X)

First off, that "as turf" isn't neccessary. It probably isn't affecting this in any way, but it's best to check. Also make doubly sure that X is a list that contains that turf. (It might help you show how you define and set up X.)

T.hp -= round(O.damage)

If the problem isn't on the above line, it would be here. Make sure that O.damage is at least 1. You might want to insert temporary debug messages to see exactly what's going on:

<code>for(var/turf/damageable/T as turf in X) world << "Before damage; [T] HP is [T.hp]" T.hp -= round(O.damage) world << "After damage; [T] HP is [T.hp]" if(T.hp < 1) del(T) del(O) break else Del(O) break</code>
In response to Crispy
Crispy wrote:
for(var/turf/damageable/T as turf in X)

First off, that "as turf" isn't neccessary. It probably isn't affecting this in any way, but it's best to check. Also make doubly sure that X is a list that contains that turf. (It might help you show how you define and set up X.)
I set up X like so
var/X = src.loc

or at least I think I did, I'm at school right now so I can't be for sure.

T.hp -= round(O.damage)

If the problem isn't on the above line, it would be here. Make sure that O.damage is at least 1. You might want to insert temporary debug messages to see exactly what's going on:

<code>for(var/turf/damageable/T as turf in X) > world << "Before damage; [T] HP is [T.hp]" > T.hp -= round(O.damage) > world << "After damage; [T] HP is [T.hp]" > if(T.hp < 1) > del(T) > del(O) > break > else > Del(O) > break</code>

I don't think that is the problem, because that really isn't doing anything that mine isn't except for displaying a message before hand. Ehhh... what am I saying, I could be wrong. I'll make sure to give it a try.

Resonating Light
In response to Resonating_Light