mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 11:12:14 +00:00
* fixes rocket launcher, but not some other issues with it * oh god oh fuck I broke everything * ok nevermind we rollin * remove a dumb testing runtime * less weird gramma on new description * change the typepath of the rocket to make it easier to know what it is * I don't remember if I even changed anything here but here it is anyways * grammar error fix * better qdel * casing to fix the article system * grammar fixes + hack to clear the mag * small hack for single round mags and makes sure icons update after being loaded * whoops * minimize diffs * capitalization with improper flag
63 lines
2.2 KiB
Plaintext
63 lines
2.2 KiB
Plaintext
/obj/item/ammo_casing/proc/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread)
|
|
distro += variance
|
|
for (var/i = max(1, pellets), i > 0, i--)
|
|
var/targloc = get_turf(target)
|
|
ready_proj(target, user, quiet, zone_override)
|
|
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 = "")
|
|
if (!BB)
|
|
return
|
|
BB.original = target
|
|
BB.firer = user
|
|
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)
|