Skip to content

Commit

Permalink
vulture usage needs a pamphlet, UI gets an upgrade, small nerf to vul…
Browse files Browse the repository at this point in the history
…ture
  • Loading branch information
Zonespace27 committed Aug 31, 2023
1 parent 87035c6 commit fcdf102
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 9 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
#define TRAIT_USING_WHEELCHAIR "t_using_wheelchair"
/// If the mob will instantly go permadead upon death
#define TRAIT_HARDCORE "t_hardcore"
/// If the mob is able to use the vulture rifle or spotting scope
#define TRAIT_VULTURE_USER "t_vulture_user"

// -- ability traits --
/// Xenos with this trait cannot have plasma transfered to them
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/weapon_stats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ As such, don't expect any values assigned to common firearms to even consider ho
//How many ticks you have to wait between firing. Burst delay uses the same variable!
*/

#define FIRE_DELAY_TIER_VULTURE 20
#define FIRE_DELAY_TIER_1 12
#define FIRE_DELAY_TIER_2 10
#define FIRE_DELAY_TIER_3 9
Expand Down
35 changes: 35 additions & 0 deletions code/game/objects/items/pamphlets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,38 @@
desc = "A piece of paper covered in crude depictions of bananas and various types of primates. Probably drawn by a three-year-old child - or an unusually intelligent marine."
trait = /datum/character_trait/language/primitive


/obj/item/pamphlet/trait
bypass_pamphlet_limit = TRUE
/// What trait to give the user
var/trait_to_give

/obj/item/pamphlet/trait/can_use(mob/living/carbon/human/user)
if(!istype(user))
return FALSE

if(HAS_TRAIT(user, trait_to_give))
to_chat(user, SPAN_WARNING("You know this already!"))
return FALSE

if(user.job != JOB_SQUAD_MARINE)
to_chat(user, SPAN_WARNING("Only squad riflemen can use this."))
return FALSE

if(user.has_used_pamphlet && !bypass_pamphlet_limit)
to_chat(user, SPAN_WARNING("You've already used a pamphlet!"))
return FALSE

return TRUE

/obj/item/pamphlet/trait/on_use(mob/living/carbon/human/user)
to_chat(user, SPAN_NOTICE(flavour_text))
ADD_TRAIT(user, trait_to_give, "pamphlet")
if(!bypass_pamphlet_limit)
user.has_used_pamphlet = TRUE

/obj/item/pamphlet/trait/vulture
name = "\improper M707 instructional pamphlet"
desc = "A pamphlet used to quickly impart vital knowledge of how to shoot big guns and spot for them."
icon_state = "pamphlet_vulture"
trait_to_give = TRAIT_VULTURE_USER
4 changes: 4 additions & 0 deletions code/game/objects/structures/vulture_spotter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
return
var/mob/living/carbon/human/user = usr //this is us

if(!HAS_TRAIT(user, TRAIT_VULTURE_USER))
to_chat(user, SPAN_WARNING("You don't know how to use this!"))
return

if(!scope_attached)
fold_up(user)
return
Expand Down
5 changes: 4 additions & 1 deletion code/modules/cm_marines/equipment/guncases.dm
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,14 @@
name = "\improper M707 anti-materiel rifle case"
desc = "A gun case containing the M707 \"Vulture\" anti-materiel rifle and its requisite spotting tools."
icon_state = "guncase_blue"
storage_slots = 5
storage_slots = 7
can_hold = list(
/obj/item/weapon/gun/boltaction/vulture,
/obj/item/ammo_magazine/rifle/boltaction/vulture,
/obj/item/device/vulture_spotter_tripod,
/obj/item/device/vulture_spotter_scope,
/obj/item/tool/screwdriver,
/obj/item/pamphlet/trait/vulture,
)

/obj/item/storage/box/guncase/vulture/update_icon()
Expand All @@ -321,6 +322,8 @@
new /obj/item/device/vulture_spotter_tripod(src)
new /obj/item/device/vulture_spotter_scope(src, WEAKREF(rifle))
new /obj/item/tool/screwdriver(src) // Spotter scope needs a screwdriver to disassemble
new /obj/item/pamphlet/trait/vulture(src) //both pamphlets give use of the scope and the rifle
new /obj/item/pamphlet/trait/vulture(src)

//Handgun case for Military police vendor three mag , a railflashligh and the handgun.

Expand Down
24 changes: 23 additions & 1 deletion code/modules/projectiles/gun_attachables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,8 @@ Defined in conflicts.dm of the #defines folder.
data["breath_cooldown"] = !COOLDOWN_FINISHED(src, hold_breath_cd)
data["breath_recharge"] = get_breath_recharge()
data["spotter_spotting"] = spotter_spotting
data["current_scope_drift"] = get_scope_drift_chance()
data["time_to_fire_remaining"] = 1 - (get_time_to_fire() / FIRE_DELAY_TIER_VULTURE)
return data

/obj/item/attachable/vulture_scope/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
Expand Down Expand Up @@ -1275,9 +1277,29 @@ Defined in conflicts.dm of the #defines folder.
. = TRUE

/obj/item/attachable/vulture_scope/process()
if(scope_drift && !holding_breath && scope_element && prob(spotter_spotting ? spotted_drift_chance : unspotted_drift_chance)) //every 6 seconds, on average
if(scope_element && prob(get_scope_drift_chance())) //every 6 seconds when unspotted, on average
scope_drift()

/obj/item/attachable/vulture_scope/proc/get_scope_drift_chance()
if(!scope_drift || holding_breath)
return 0

if(spotter_spotting)
return spotted_drift_chance

else
return unspotted_drift_chance

/obj/item/attachable/vulture_scope/proc/get_time_to_fire()
if(!istype(loc, /obj/item/weapon/gun/boltaction/vulture))
return 0

var/obj/item/weapon/gun/boltaction/vulture/rifle = loc
if(!rifle.last_fired)
return 0

return (rifle.last_fired + rifle.get_fire_delay()) - world.time

/obj/item/attachable/vulture_scope/activate_attachment(obj/item/weapon/gun/gun, mob/living/carbon/user, turn_off)
if(turn_off || scoping)
on_unscope()
Expand Down
15 changes: 13 additions & 2 deletions code/modules/projectiles/guns/boltaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@
has_openbolt_icon = FALSE
bolt_delay = 1 SECONDS
/// How far out people can tell the direction of the shot
var/fire_message_range = 22
var/fire_message_range = 25
/// If the gun should bypass the trait requirement
var/bypass_trait = FALSE

/obj/item/weapon/gun/boltaction/vulture/update_icon()
..()
Expand All @@ -166,7 +168,7 @@

/obj/item/weapon/gun/boltaction/vulture/set_gun_config_values() //check that these work
..()
set_fire_delay(FIRE_DELAY_TIER_2)
set_fire_delay(FIRE_DELAY_TIER_VULTURE)
accuracy_mult = BASE_ACCURACY_MULT + HIT_ACCURACY_MULT_TIER_7
accuracy_mult_unwielded = BASE_ACCURACY_MULT - HIT_ACCURACY_MULT_TIER_10
scatter = SCATTER_AMOUNT_TIER_10
Expand All @@ -180,6 +182,15 @@
/obj/item/weapon/gun/boltaction/vulture/set_gun_attachment_offsets()
attachable_offset = list("muzzle_x" = 33, "muzzle_y" = 19, "rail_x" = 11, "rail_y" = 24, "under_x" = 25, "under_y" = 14, "stock_x" = 11, "stock_y" = 15)

/obj/item/weapon/gun/boltaction/vulture/able_to_fire(mob/user)
. = ..()
if(!.)
return

if(!bypass_trait && !HAS_TRAIT(user, TRAIT_VULTURE_USER))
to_chat(user, SPAN_WARNING("You don't know how to use this!"))
return

/obj/item/weapon/gun/boltaction/vulture/Fire(atom/target, mob/living/user, params, reflex, dual_wield)
var/obj/item/attachable/vulture_scope/scope = attachments["rail"]
if(istype(scope) && scope.scoping)
Expand Down
Binary file modified icons/obj/items/pamphlets.dmi
Binary file not shown.
39 changes: 34 additions & 5 deletions tgui/packages/tgui/interfaces/VultureScope.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type ScopeData = {
scope_cooldown: BooleanLike;
breath_cooldown: BooleanLike;
breath_recharge: Number;
current_scope_drift: Number;
time_to_fire_remaining: Number;
};

enum Direction {
Expand Down Expand Up @@ -161,11 +163,10 @@ const ScopePosition = (props, context) => {
);
};

const BreathButton = (props, context) => {
const { dir } = props;
const SecondarySection = (props, context) => {
const { data, act } = useBackend<ScopeData>(context);
return (
<Section title="Breathing" textAlign="center">
<Section title="Breathing & Data" textAlign="center">
<Flex.Item grow={1} basis={0}>
<Button
content="Control Breathing"
Expand Down Expand Up @@ -193,22 +194,50 @@ const BreathButton = (props, context) => {
Recharge
</ProgressBar>
</Flex.Item>
<Flex.Item>
<div style={{ 'padding-top': '8px', 'padding-bottom': '8px' }}>
<ProgressBar
minValue={0}
maxValue={100}
value={data.current_scope_drift}
ranges={{
good: [-Infinity, 0],
average: [1, 50],
bad: [51, Infinity],
}}>
Scope Drift: {data.current_scope_drift}%
</ProgressBar>
</div>
</Flex.Item>
<Flex.Item>
<ProgressBar
minValue={0}
maxValue={1}
value={data.time_to_fire_remaining}
ranges={{
good: [0.8, Infinity],
average: [0.5, 0.8],
bad: [-Infinity, 0.5],
}}>
Fire Readiness
</ProgressBar>
</Flex.Item>
</Section>
);
};

export const VultureScope = (props, context) => {
const { act, data } = useBackend<ScopeData>(context);
return (
<Window title="Scope Configuration" width={325} height={350}>
<Window title="Scope Configuration" width={325} height={400}>
<Window.Content>
<Section title="Scope Adjustments">
<div style={{ 'display': 'flex' }}>
<OffsetAdjuster />
<PositionAdjuster />
</div>
</Section>
<BreathButton />
<SecondarySection />
</Window.Content>
</Window>
);
Expand Down

0 comments on commit fcdf102

Please sign in to comment.