mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
* knockback component can now be reversed, has projectile and gun handling, and hostile simplemob handling adds signals for hostile mobs attacking, altering projectiles before firing, and for when projectiles successfully hit their target moves knockback handling to a general proc adds ishelpers for guns and projectiles * no more weird projectile handling it can just not apply the effect if the component somehow goes away lifesteal actually works now instead of being a blank file, applies a flat healing effect when you hit something * fixes up comsig stuff adds new components to the fantasy prefix and suffix knockback now handles throwing anchored objects lifesteal now properly heals the target with projectiel weapons adds summoning component to handle mob summoning with item attacking and such adds fired_from variable to handle what a projectile was fired_from, firer would be the mob that fired and fired_from would be the gun, in the case of an autoturret, fired_from and firer would be the same adds shrapnel component, fires projectiles around a fired projectile when it hits adds igniter component to set attacked mobs on fire * no more shrapnel on items that can't use it summoning items now summon at least one mob maximum adds specific weighted projectile types for shrapnel to prevent broken options being picked removes the reverse var from knockback component and instead just handles negative thrown turf
64 lines
2.2 KiB
Plaintext
64 lines
2.2 KiB
Plaintext
/obj/item/ammo_casing/proc/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread, atom/fired_from)
|
|
distro += variance
|
|
for (var/i = max(1, pellets), i > 0, i--)
|
|
var/targloc = get_turf(target)
|
|
ready_proj(target, user, quiet, zone_override, fired_from)
|
|
if(distro) //We have to spread a pixel-precision bullet. throw_proj was called before so angles should exist by now...
|
|
if(randomspread)
|
|
spread = round((rand() - 0.5) * distro)
|
|
else //Smart spread
|
|
spread = round((i / pellets - 0.5) * distro)
|
|
if(!throw_proj(target, targloc, user, params, spread))
|
|
return 0
|
|
if(i > 1)
|
|
newshot()
|
|
if(click_cooldown_override)
|
|
user.changeNext_move(click_cooldown_override)
|
|
else
|
|
user.changeNext_move(CLICK_CD_RANGE)
|
|
user.newtonian_move(get_dir(target, user))
|
|
update_icon()
|
|
return TRUE
|
|
|
|
/obj/item/ammo_casing/proc/ready_proj(atom/target, mob/living/user, quiet, zone_override = "", atom/fired_from)
|
|
if (!BB)
|
|
return
|
|
BB.original = target
|
|
BB.firer = user
|
|
BB.fired_from = fired_from
|
|
if (zone_override)
|
|
BB.def_zone = zone_override
|
|
else
|
|
BB.def_zone = user.zone_selected
|
|
BB.suppressed = quiet
|
|
|
|
if(reagents && BB.reagents)
|
|
reagents.trans_to(BB, reagents.total_volume, transfered_by = user) //For chemical darts/bullets
|
|
qdel(reagents)
|
|
|
|
/obj/item/ammo_casing/proc/throw_proj(atom/target, turf/targloc, mob/living/user, params, spread)
|
|
var/turf/curloc = get_turf(user)
|
|
if (!istype(targloc) || !istype(curloc) || !BB)
|
|
return FALSE
|
|
|
|
var/firing_dir
|
|
if(BB.firer)
|
|
firing_dir = BB.firer.dir
|
|
if(!BB.suppressed && firing_effect_type)
|
|
new firing_effect_type(get_turf(src), firing_dir)
|
|
|
|
var/direct_target
|
|
if(targloc == curloc)
|
|
if(target) //if the target is right on our location we'll skip the travelling code in the proj's fire()
|
|
direct_target = target
|
|
if(!direct_target)
|
|
BB.preparePixelProjectile(target, user, params, spread)
|
|
BB.fire(null, direct_target)
|
|
BB = null
|
|
return TRUE
|
|
|
|
/obj/item/ammo_casing/proc/spread(turf/target, turf/current, distro)
|
|
var/dx = abs(target.x - current.x)
|
|
var/dy = abs(target.y - current.y)
|
|
return locate(target.x + round(gaussian(0, distro) * (dy+2)/8, 1), target.y + round(gaussian(0, distro) * (dx+2)/8, 1), target.z)
|