mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 15:17:01 +01:00
Cleans up gaming signals and arcade machine code (#90122)
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
/obj/machinery/computer/arcade/amputation/attack_tk(mob/user)
|
||||
return //that's a pretty damn big guillotine
|
||||
|
||||
/obj/machinery/computer/arcade/amputation/attack_hand(mob/user, list/modifiers)
|
||||
/obj/machinery/computer/arcade/amputation/attack_hand(mob/living/user, list/modifiers)
|
||||
. = ..()
|
||||
if(!iscarbon(user))
|
||||
return
|
||||
|
||||
@@ -120,13 +120,13 @@
|
||||
|
||||
name = make_boss_name_with_verb()
|
||||
|
||||
/obj/machinery/computer/arcade/battle/emag_act(mob/user, obj/item/card/emag/emag_card)
|
||||
/obj/machinery/computer/arcade/battle/emag_act(mob/living/user, obj/item/card/emag/emag_card)
|
||||
if(obj_flags & EMAGGED)
|
||||
return FALSE
|
||||
obj_flags |= EMAGGED
|
||||
balloon_alert(user, "hard mode enabled")
|
||||
to_chat(user, span_warning("A mesmerizing Rhumba beat starts playing from the arcade machine's speakers!"))
|
||||
setup_new_opponent()
|
||||
setup_new_opponent(user)
|
||||
feedback_message = "If you die in the game, you die for real!"
|
||||
SStgui.update_uis(src)
|
||||
return TRUE
|
||||
@@ -175,7 +175,7 @@
|
||||
return "The [boss_adjective] [boss_name]"
|
||||
|
||||
///Sets up a new opponent depending on what stage they are at.
|
||||
/obj/machinery/computer/arcade/battle/proc/setup_new_opponent(enemy_gets_first_move = FALSE)
|
||||
/obj/machinery/computer/arcade/battle/proc/setup_new_opponent(mob/living/user, enemy_gets_first_move = FALSE)
|
||||
enemy_hp = round(rand(90, 125) * all_worlds[player_current_world], 1)
|
||||
enemy_mp = round(rand(20, 30) * all_worlds[player_current_world], 1)
|
||||
enemy_gold_reward = rand((DEFAULT_ITEM_PRICE / 2), DEFAULT_ITEM_PRICE)
|
||||
@@ -201,7 +201,7 @@
|
||||
ui_panel = UI_PANEL_BATTLE
|
||||
|
||||
if(enemy_gets_first_move)
|
||||
perform_enemy_turn()
|
||||
perform_enemy_turn(user)
|
||||
|
||||
/**
|
||||
* on_battle_win
|
||||
@@ -210,7 +210,7 @@
|
||||
* It also handles clearing the enemy out for the next one, and unlocking new worlds.
|
||||
* We stop at BATTLE_WORLD_NINE because it is the last stage, and has infinite bosses.
|
||||
*/
|
||||
/obj/machinery/computer/arcade/battle/proc/on_battle_win(mob/user)
|
||||
/obj/machinery/computer/arcade/battle/proc/on_battle_win(mob/living/user)
|
||||
enemy_name = null
|
||||
feedback_message = null
|
||||
player_turn = TRUE
|
||||
@@ -229,8 +229,8 @@
|
||||
bomb_cooldown = initial(bomb_cooldown)
|
||||
new /obj/effect/spawner/newbomb/plasma(loc, /obj/item/assembly/timer)
|
||||
new /obj/item/clothing/head/collectable/petehat(loc)
|
||||
message_admins("[ADMIN_LOOKUPFLW(usr)] has outbombed Cuban Pete and been awarded a bomb.")
|
||||
usr.log_message("outbombed Cuban Pete and has been awarded a bomb.", LOG_GAME)
|
||||
message_admins("[ADMIN_LOOKUPFLW(user)] has outbombed Cuban Pete and been awarded a bomb.")
|
||||
user.log_message("outbombed Cuban Pete and has been awarded a bomb.", LOG_GAME)
|
||||
else
|
||||
visible_message(span_notice("[src] dispenses 2 tickets!"))
|
||||
new /obj/item/stack/arcadeticket((get_turf(src)), 2)
|
||||
@@ -245,15 +245,15 @@
|
||||
ui_panel = UI_PANEL_BETWEEN_FIGHTS
|
||||
|
||||
///Called when a mob loses at the battle arcade.
|
||||
/obj/machinery/computer/arcade/battle/proc/lose_game(mob/user)
|
||||
if(obj_flags & EMAGGED)
|
||||
var/mob/living/living_user = user
|
||||
if(istype(living_user))
|
||||
living_user.investigate_log("has been gibbed by an emagged Orion Trail game.", INVESTIGATE_DEATHS)
|
||||
living_user.gib(DROP_ALL_REMAINS)
|
||||
user.lost_game()
|
||||
/obj/machinery/computer/arcade/battle/proc/lose_game(mob/living/user)
|
||||
SSblackbox.record_feedback("nested tally", "arcade_results", 1, list("loss", "hp", (obj_flags & EMAGGED ? "emagged":"normal")))
|
||||
SStgui.update_uis(src)
|
||||
if (!user)
|
||||
return
|
||||
user.lost_game()
|
||||
if(obj_flags & EMAGGED)
|
||||
user.investigate_log("has been gibbed by an emagged Orion Trail game.", INVESTIGATE_DEATHS)
|
||||
user.gib(DROP_ALL_REMAINS)
|
||||
|
||||
///Called when the enemy attacks you.
|
||||
/obj/machinery/computer/arcade/battle/proc/user_take_damage(mob/user, base_damage_taken)
|
||||
@@ -266,10 +266,11 @@
|
||||
say("You have been crushed! GAME OVER.")
|
||||
playsound(loc, 'sound/machines/arcade/lose.ogg', 40, TRUE)
|
||||
lose_game(user)
|
||||
else
|
||||
feedback_message = "User took [damage_taken] damage!"
|
||||
playsound(loc, 'sound/machines/arcade/hit.ogg', 40, TRUE, extrarange = -3)
|
||||
SStgui.update_uis(src)
|
||||
return
|
||||
|
||||
feedback_message = "User took [damage_taken] damage!"
|
||||
playsound(loc, 'sound/machines/arcade/hit.ogg', 40, TRUE, extrarange = -3)
|
||||
SStgui.update_uis(src)
|
||||
|
||||
///Called when you attack the enemy.
|
||||
/obj/machinery/computer/arcade/battle/proc/process_player_attack(mob/user, attack_type)
|
||||
@@ -339,7 +340,7 @@
|
||||
* if they lack the MP, then it's rolling to steal MP from the player.
|
||||
* After, we will roll to see if the player counterattacks the enemy (if set), otherwise we will attack normally.
|
||||
*/
|
||||
/obj/machinery/computer/arcade/battle/proc/perform_enemy_turn(mob/user, defending_flags = NONE)
|
||||
/obj/machinery/computer/arcade/battle/proc/perform_enemy_turn(mob/living/user, defending_flags = NONE)
|
||||
player_turn = TRUE
|
||||
var/chance_to_magic = round(max((-(enemy_hp - enemy_max_hp) / 2), 75), 1)
|
||||
if((enemy_hp != enemy_max_hp) && prob(chance_to_magic))
|
||||
@@ -438,6 +439,7 @@
|
||||
if(!istype(gamer))
|
||||
return
|
||||
|
||||
gamer.played_game()
|
||||
switch(ui_panel)
|
||||
if(UI_PANEL_GAMEOVER)
|
||||
switch(action)
|
||||
@@ -478,7 +480,7 @@
|
||||
say("That world is not unlocked yet!")
|
||||
return TRUE
|
||||
player_current_world = all_worlds[world_travelling]
|
||||
setup_new_opponent()
|
||||
setup_new_opponent(gamer)
|
||||
return TRUE
|
||||
if("enter_inn")
|
||||
ui_panel = UI_PANEL_SHOP
|
||||
@@ -486,7 +488,7 @@
|
||||
if(UI_PANEL_BETWEEN_FIGHTS)
|
||||
switch(action)
|
||||
if("continue_without_rest")
|
||||
setup_new_opponent()
|
||||
setup_new_opponent(gamer)
|
||||
return TRUE
|
||||
if("continue_with_rest")
|
||||
if(prob(60))
|
||||
@@ -500,9 +502,9 @@
|
||||
player_gold /= 2
|
||||
else
|
||||
//You got ambushed, the enemy gets the first hit.
|
||||
setup_new_opponent(enemy_gets_first_move = TRUE)
|
||||
setup_new_opponent(gamer, enemy_gets_first_move = TRUE)
|
||||
return TRUE
|
||||
setup_new_opponent()
|
||||
setup_new_opponent(gamer)
|
||||
return TRUE
|
||||
if("abandon_quest")
|
||||
if(player_current_world == latest_unlocked_world)
|
||||
|
||||
@@ -78,9 +78,8 @@
|
||||
if(!(event.type in event_whitelist))
|
||||
events.Remove(event)
|
||||
|
||||
/obj/machinery/computer/arcade/orion_trail/proc/newgame()
|
||||
/obj/machinery/computer/arcade/orion_trail/proc/newgame(mob/living/player)
|
||||
// Set names of settlers in crew
|
||||
var/mob/living/player = usr
|
||||
var/player_crew_name = first_name(player.name)
|
||||
settlers = list()
|
||||
for(var/i in 1 to ORION_STARTING_CREW_COUNT - 1) //one reserved to be YOU
|
||||
@@ -183,7 +182,7 @@
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/mob/living/gamer = usr
|
||||
var/mob/living/gamer = ui.user
|
||||
if(!istype(gamer))
|
||||
return
|
||||
|
||||
@@ -213,7 +212,7 @@
|
||||
if("start_game")
|
||||
if(gameStatus != ORION_STATUS_START)
|
||||
return
|
||||
newgame()
|
||||
newgame(gamer)
|
||||
if("instructions")
|
||||
if(gameStatus != ORION_STATUS_START)
|
||||
return
|
||||
@@ -333,9 +332,8 @@
|
||||
if(obj_flags & EMAGGED)
|
||||
event.emag_effect(src, gamer)
|
||||
|
||||
/obj/machinery/computer/arcade/orion_trail/proc/set_game_over(user, given_reason)
|
||||
usr.lost_game()
|
||||
|
||||
/obj/machinery/computer/arcade/orion_trail/proc/set_game_over(mob/living/user, given_reason)
|
||||
user.lost_game()
|
||||
gameStatus = ORION_STATUS_GAMEOVER
|
||||
event = null
|
||||
reason = given_reason || death_reason(user)
|
||||
@@ -463,15 +461,14 @@
|
||||
if(lings_suspected) //lings ruin any good mood
|
||||
settlermoods[settlers[i]] = min(settlermoods[settlers[i]], 3)
|
||||
|
||||
/obj/machinery/computer/arcade/orion_trail/proc/win(mob/user)
|
||||
usr.won_game()
|
||||
|
||||
/obj/machinery/computer/arcade/orion_trail/proc/win(mob/living/user)
|
||||
user.won_game()
|
||||
gameStatus = ORION_STATUS_START
|
||||
say("Congratulations, you made it to Orion!")
|
||||
if(obj_flags & EMAGGED)
|
||||
new /obj/item/orion_ship(loc)
|
||||
message_admins("[ADMIN_LOOKUPFLW(usr)] made it to Orion on an emagged machine and got an explosive toy ship.")
|
||||
usr.log_message("made it to Orion on an emagged machine and got an explosive toy ship.", LOG_GAME)
|
||||
message_admins("[ADMIN_LOOKUPFLW(user)] made it to Orion on an emagged machine and got an explosive toy ship.")
|
||||
user.log_message("made it to Orion on an emagged machine and got an explosive toy ship.", LOG_GAME)
|
||||
else
|
||||
new /obj/item/stack/arcadeticket((get_turf(src)), 2)
|
||||
to_chat(user, span_notice("[src] dispenses 2 tickets!"))
|
||||
@@ -479,17 +476,21 @@
|
||||
name = initial(name)
|
||||
desc = initial(desc)
|
||||
|
||||
/obj/machinery/computer/arcade/orion_trail/emag_act(mob/user, obj/item/card/emag/emag_card)
|
||||
/obj/machinery/computer/arcade/orion_trail/emag_act(mob/living/user, obj/item/card/emag/emag_card)
|
||||
if(obj_flags & EMAGGED)
|
||||
return FALSE
|
||||
if (user)
|
||||
user.log_message("emagged [src], activating Realism Mode.", LOG_GAME)
|
||||
balloon_alert(user, "realism mode enabled")
|
||||
to_chat(user, span_notice("You override the cheat code menu and skip to Cheat #[rand(1, 50)]: Realism Mode."))
|
||||
|
||||
name = "The Orion Trail: Realism Edition"
|
||||
desc = "Learn how our ancestors got to Orion, and try not to die in the process!"
|
||||
newgame()
|
||||
obj_flags |= EMAGGED
|
||||
|
||||
if (!user)
|
||||
return TRUE
|
||||
|
||||
user.log_message("emagged [src], activating Realism Mode.", LOG_GAME)
|
||||
balloon_alert(user, "realism mode enabled")
|
||||
to_chat(user, span_notice("You override the cheat code menu and skip to Cheat #[rand(1, 50)]: Realism Mode."))
|
||||
newgame(user)
|
||||
return TRUE
|
||||
|
||||
///A minibomb achieved from winning at emagged Orion.
|
||||
@@ -515,7 +516,7 @@
|
||||
if(active)
|
||||
return
|
||||
|
||||
log_bomber(usr, "primed an explosive", src, "for detonation")
|
||||
log_bomber(user, "primed an explosive", src, "for detonation")
|
||||
to_chat(user, span_warning("You flip the switch on the underside of [src]."))
|
||||
active = TRUE
|
||||
addtimer(CALLBACK(src, PROC_REF(commit_explosion)), 1 SECONDS)
|
||||
|
||||
@@ -2796,8 +2796,20 @@ GLOBAL_LIST_EMPTY(fire_appearances)
|
||||
return
|
||||
mob_mood.clear_mood_event(category)
|
||||
|
||||
/mob/living/played_game()
|
||||
. = ..()
|
||||
/// This should be called by games when the gamer reaches a winning state, just sends a signal
|
||||
/mob/living/proc/won_game()
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
SEND_SIGNAL(src, COMSIG_MOB_WON_VIDEOGAME)
|
||||
|
||||
/// This should be called by games when the gamer reaches a losing state, just sends a signal
|
||||
/mob/living/proc/lost_game()
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
SEND_SIGNAL(src, COMSIG_MOB_LOST_VIDEOGAME)
|
||||
|
||||
/// This should be called by games whenever the gamer interacts with the device, sends a signal and grants us a moodlet
|
||||
/mob/living/proc/played_game()
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
SEND_SIGNAL(src, COMSIG_MOB_PLAYED_VIDEOGAME)
|
||||
add_mood_event("gaming", /datum/mood_event/gaming)
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* This proc sends the COMSIG_MOB_WON_VIDEOGAME signal
|
||||
*
|
||||
* This should be called by games when the gamer reaches a winning state
|
||||
*/
|
||||
/mob/proc/won_game()
|
||||
SEND_SIGNAL(src, COMSIG_MOB_WON_VIDEOGAME)
|
||||
|
||||
/**
|
||||
* This proc sends the COMSIG_MOB_LOST_VIDEOGAME signal
|
||||
*
|
||||
* This should be called by games when the gamer reaches a losing state
|
||||
*/
|
||||
/mob/proc/lost_game()
|
||||
SEND_SIGNAL(src, COMSIG_MOB_LOST_VIDEOGAME)
|
||||
|
||||
/**
|
||||
* This proc sends the COMSIG_MOB_PLAYED_VIDEOGAME signal
|
||||
*
|
||||
* This should be called by games whenever the gamer interacts with the device
|
||||
*/
|
||||
/mob/proc/played_game()
|
||||
SEND_SIGNAL(src, COMSIG_MOB_PLAYED_VIDEOGAME)
|
||||
@@ -37,7 +37,7 @@
|
||||
heads_up = "Are you a bad enough dude to grief the station?"
|
||||
boss_name = "George Melon"
|
||||
|
||||
/datum/computer_file/program/arcade/proc/game_check(mob/user)
|
||||
/datum/computer_file/program/arcade/proc/game_check(mob/living/user)
|
||||
sleep(0.5 SECONDS)
|
||||
user?.mind?.adjust_experience(/datum/skill/gaming, 1)
|
||||
if(boss_hp <= 0)
|
||||
@@ -49,7 +49,7 @@
|
||||
computer.update_appearance()
|
||||
ticket_count += 1
|
||||
user?.mind?.adjust_experience(/datum/skill/gaming, 50)
|
||||
usr.won_game()
|
||||
user.won_game()
|
||||
sleep(1 SECONDS)
|
||||
else if(player_hp <= 0 || player_mp <= 0)
|
||||
heads_up = "You have been defeated... how will the station survive?"
|
||||
@@ -59,10 +59,10 @@
|
||||
if(istype(computer))
|
||||
computer.update_appearance()
|
||||
user?.mind?.adjust_experience(/datum/skill/gaming, 10)
|
||||
usr.lost_game()
|
||||
user.lost_game()
|
||||
sleep(1 SECONDS)
|
||||
|
||||
/datum/computer_file/program/arcade/proc/enemy_check(mob/user)
|
||||
/datum/computer_file/program/arcade/proc/enemy_check(mob/living/user)
|
||||
var/boss_attackamt = 0 //Spam protection from boss attacks as well.
|
||||
var/boss_mpamt = 0
|
||||
var/bossheal = 0
|
||||
@@ -88,7 +88,7 @@
|
||||
player_hp -= boss_attackamt
|
||||
|
||||
pause_state = FALSE
|
||||
game_check()
|
||||
game_check(user)
|
||||
|
||||
/datum/computer_file/program/arcade/ui_assets(mob/user)
|
||||
return list(
|
||||
@@ -109,12 +109,15 @@
|
||||
|
||||
/datum/computer_file/program/arcade/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
. = ..()
|
||||
usr.played_game()
|
||||
var/mob/living/gamer = ui.user
|
||||
if (!istype(gamer))
|
||||
return
|
||||
gamer.played_game()
|
||||
var/gamerSkillLevel = 0
|
||||
var/gamerSkill = 0
|
||||
if(usr?.mind)
|
||||
gamerSkillLevel = usr.mind.get_skill_level(/datum/skill/gaming)
|
||||
gamerSkill = usr.mind.get_skill_modifier(/datum/skill/gaming, SKILL_RANDS_MODIFIER)
|
||||
if(gamer?.mind)
|
||||
gamerSkillLevel = gamer.mind.get_skill_level(/datum/skill/gaming)
|
||||
gamerSkill = gamer.mind.get_skill_modifier(/datum/skill/gaming, SKILL_RANDS_MODIFIER)
|
||||
switch(action)
|
||||
if("Attack")
|
||||
var/attackamt = 0 //Spam prevention.
|
||||
@@ -125,8 +128,8 @@
|
||||
playsound(computer.loc, 'sound/machines/arcade/hit.ogg', 50, TRUE)
|
||||
boss_hp -= attackamt
|
||||
sleep(1 SECONDS)
|
||||
game_check()
|
||||
enemy_check()
|
||||
game_check(gamer)
|
||||
enemy_check(gamer)
|
||||
return TRUE
|
||||
if("Heal")
|
||||
var/healamt = 0 //More Spam Prevention.
|
||||
@@ -143,8 +146,8 @@
|
||||
player_hp += healamt
|
||||
player_mp -= healcost
|
||||
sleep(1 SECONDS)
|
||||
game_check()
|
||||
enemy_check()
|
||||
game_check(gamer)
|
||||
enemy_check(gamer)
|
||||
return TRUE
|
||||
if("Recharge_Power")
|
||||
var/rechargeamt = 0 //As above.
|
||||
@@ -155,22 +158,22 @@
|
||||
playsound(computer.loc, 'sound/machines/arcade/mana.ogg', 50, TRUE)
|
||||
player_mp += rechargeamt
|
||||
sleep(1 SECONDS)
|
||||
game_check()
|
||||
enemy_check()
|
||||
game_check(gamer)
|
||||
enemy_check(gamer)
|
||||
return TRUE
|
||||
if("Dispense_Tickets")
|
||||
if(computer.stored_paper <= 0)
|
||||
to_chat(usr, span_notice("Printer is out of paper."))
|
||||
to_chat(gamer, span_notice("Printer is out of paper."))
|
||||
return
|
||||
else
|
||||
computer.visible_message(span_notice("\The [computer] prints out paper."))
|
||||
if(ticket_count >= 1)
|
||||
new /obj/item/stack/arcadeticket((get_turf(computer)), 1)
|
||||
to_chat(usr, span_notice("[computer] dispenses a ticket!"))
|
||||
to_chat(gamer, span_notice("[computer] dispenses a ticket!"))
|
||||
ticket_count -= 1
|
||||
computer.stored_paper -= 1
|
||||
else
|
||||
to_chat(usr, span_notice("You don't have any stored tickets!"))
|
||||
to_chat(gamer, span_notice("You don't have any stored tickets!"))
|
||||
return TRUE
|
||||
if("Start_Game")
|
||||
game_active = TRUE
|
||||
|
||||
@@ -4822,7 +4822,6 @@
|
||||
#include "code\modules\mob\login.dm"
|
||||
#include "code\modules\mob\logout.dm"
|
||||
#include "code\modules\mob\mob.dm"
|
||||
#include "code\modules\mob\mob_arcade.dm"
|
||||
#include "code\modules\mob\mob_defines.dm"
|
||||
#include "code\modules\mob\mob_helpers.dm"
|
||||
#include "code\modules\mob\mob_lists.dm"
|
||||
|
||||
Reference in New Issue
Block a user